I have selected a range of cells. I am now trying to copy the selected cells from the worksheet and paste them onto a new sheet. I have already added the sheet, and I have the name of the new sheet. How do I copy and paste it?
04-02-2003, 12:53 PM
You could use the macrorecorder to get the code of what you wish to do.
You will see you'll get something like this as result :
Thanks, I did it already. However I am having some trouble. I'm doing it in a loop. I select a range, copy it, add a sheet, paste it, and then move to the next range. This works for the fisrt one but it doesn't go through the loop again. Without the pasting code, I know that it loops through all the code and copies it. But for some reason it only pastes blank cells on all but the first range.
Here's my code:
For c = LBound(intarray) To (UBound(intarray) - 1)
Dim rowref As String
Let i = intarray(c)
Let j = (intarray(c + 1) - 1)
Let rowref = i & ":" & j
sheetName = namearray(c)
04-02-2003, 01:48 PM
Hmm i'm not that good in array stuff so i'm afraid that i can't help you with this...
I figured out the problem. It has nothing to do with arrays. Once it pasted the data, I never set the focus back to the oroginal sheet so it's copying for the new sheet which is blank besides for the first 4 rows, so it copies the blank cells.
04-02-2003, 02:01 PM
Stupid of me not to see that > ai,ai,ai
Next time i'll have a better look...