View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
gocush[_29_] gocush[_29_] is offline
external usenet poster
 
Posts: 252
Default I need a macro to copy

Individual blank cells don't matter; it's a set of blank cells at the
perimeter that define or enclose Rng.CurrentRegion


"PCOR" wrote:

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
"gocush" /delete wrote in message
...
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.

"Edwin Tam" wrote:

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

http://www.vonixx.com


"PCOR" wrote:


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
..
--
Norton Professional 2004 says this email is clean...believe it