I need a macro to copy

  • Thread starter Thread starter PCOR
  • Start date Start date
P

PCOR

I need a macro that will copy a given range and paste it. The range will
vary
It wll always start at A1 but may go to row 50 or 75 and col g or k or any
other col.
Also a macro that will copy all that is located on the sheet and paste it
somewhere else
Thanks
..
 
Maybe this statement is what you need:

Sub copy_macro()
ActiveSheet.UsedRange.Copy Worksheets(2).Range("A1")
End Sub

You can change the worksheets(2).range("A1") to other locations.

Regards,
Edwin Tam
(e-mail address removed)
http://www.vonixx.com
 
That woeked just GREAT
Now can you tell me how to do the same but to copy to that last ROW but to
a given col(say Col K)
Thanks much
 
Sub copy_macro()
ActiveSheet.Range("A1").CurrentRegion.Copy Worksheets(2).Range("A1")
End Sub

This (CurrentRegion) will include all rows and columns from the starting
point ( including rows above or below and columns to the left and right)
until it finds a blank column or blank row. Hence you must not have
extraneous data ADJACENT to the range you intend for this code.
 
Thanks a lot but.....
can you tell me how to do it for the following conditions:
Copy from A1 to the last row(including the last row) there could be blanks
in row 5 and 20 and to go to COL K
Thanks again very much
 
Individual blank cells don't matter; it's a set of blank cells at the
perimeter that define or enclose Rng.CurrentRegion
 

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

Back
Top