0

Let's say we have a column of cells value in column A and need to permute this column randomly into column B as in this simple sample.

How can I do that?

I tried with my VBA code but it seems not working. I guess my below command got some issues that I don't know what they are - I need to transfer back the array of values in variable varValues back into the cells

Range("B1:B10").Cells.Value = varValues
3
  • 2
    You can't run your function to do both at the same time: change any value to different cell (which is forbidden for functions) other than destination cell and return value like 'Done' at the same time. You need to choose which direction you want to go. Commented Jun 17, 2013 at 5:17
  • I see. I'll choose to run the method as a macro Commented Jun 17, 2013 at 5:24
  • 1
    so, is your problem solved (I think it is now) or you need any further help? Commented Jun 17, 2013 at 5:38

2 Answers 2

1

I tested the code from the sample file and it works without any editing. Is that the code you are having trouble with? If not please post the actual code you have trouble with.

If you're looking to replace the original then simply have the same range as the code in the file e.g.

Set rng = Range("A1:A10")
...
Range("A1:A10").Cells.Value2 = varValues
Sign up to request clarification or add additional context in comments.

1 Comment

Indeed I've just learned the syntax to assign array to cells and noted here namgivu.wordpress.com/2013/06/17/…
0

My issues are

  • Running methods that change the cells' values must be done via macro
  • Assigning variant data type to range's cells value is done via correct syntax e.g, Range("a1:a10") = xdata

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.