copy and paste macro

R

Robert

I need help creating a macro to copy cells C3:C22 and then PasteSpecial,
ValuesOnly to cells O12:O32. Then the next time I run the macro, I need it
to paste the C3:C22 values into the next available blank column, P12:p32. It
has to be able to do that for a total of 12 times, each time using the naxt
available blank column. It then has to automatically erase it all, O12:Z32.
Then it would start over with the O column again.

I would appreciate it if somebody could show me the complete macro to
accomplish these steps. Thank you.

Robert
 
R

Robert

Simon, thank you for the information but I'm afraid I'm not smart enough to
understand the answer. I am running Excel 2002 and I'm wondering if your
answer applies to a later version. I should have sent you what I already
have and asked you to fix that. Here is what I have so far. It of course
just copies everything into the first column and never advances to the next
empty one.

Sub copy_paste()
'
' copy_paste Macro

'
' Keyboard Shortcut: Ctrl+c
'
Range("C3:C23").Select
Selection.Copy
Range("O12:O32").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("C3").Select
Application.CutCopyMode = False
End Sub

Thank you again for your help. I've been struggling with this for days.

Robert

Simon Lloyd said:
This should do what you need:
 
R

Robert

Thanks again Simon for all your time. I do appreciate it.

When I run the macro one time, it fills all the columns in and then stops.
I can run it over again and it does the same thing.

I pasted your code into an empty module and assigned a shortcut key to it
and then run it with that.

Am I doing something wrong?

Robert

Simon Lloyd said:
Did you try replacing your code for mine? it should have worked as
needed, just replace yours with the code below and it will populate 12
coulms with the data as requested:
VBA Code:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top