ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   devide rng of copy (https://www.excelbanter.com/excel-programming/347562-devide-rng-copy.html)

sal21[_89_]

devide rng of copy
 

i have this rng:
lngMaxRow = Range("A65536").End(xlUp).Row

Set rng = Union(Range("A3:K" & lngMaxRow), Range("N3:AC"
lngMaxRow)).SpecialCells(xlCellTypeVisible)

i would want to copy the first block a3:k of current sheet into a3:k o
ActiveWorkbook.Sheets(1)

i would want to copy the second block n3:ac of current sheet into n3:a
of ActiveWorkbook.Sheets(1)

i have used this but not work!!!!!!!!:

rng.Copy ActiveWorkbook.Sheets(1).Range("A3")
_________________

--
sal2

-----------------------------------------------------------------------
sal21's Profile: http://www.excelforum.com/member.php...nfo&userid=204
View this thread: http://www.excelforum.com/showthread.php?threadid=49163


Rowan Drummond[_3_]

devide rng of copy
 
Try:

'----------------------------------------------------------------
lngMaxRow = Range("A65536").End(xlUp).Row

On Error Resume Next
Set rng = Range("A3:K" & lngMaxRow).SpecialCells(xlCellTypeVisible)
On Error GoTo 0

If Not rng Is Nothing Then rng.Copy _
ActiveWorkbook.Sheets(1).Range("A3")

Set rng = Nothing

On Error Resume Next
Set rng = Range("N3:AC" & lngMaxRow).SpecialCells(xlCellTypeVisible)
On Error GoTo 0

If Not rng Is Nothing Then rng.Copy _
ActiveWorkbook.Sheets(1).Range("N3")
'------------------------------------------------------------------

Hope this helps
Rowan

sal21 wrote:
i have this rng:
lngMaxRow = Range("A65536").End(xlUp).Row

Set rng = Union(Range("A3:K" & lngMaxRow), Range("N3:AC" &
lngMaxRow)).SpecialCells(xlCellTypeVisible)

i would want to copy the first block a3:k of current sheet into a3:k of
ActiveWorkbook.Sheets(1)

i would want to copy the second block n3:ac of current sheet into n3:ac
of ActiveWorkbook.Sheets(1)

i have used this but not work!!!!!!!!:

rng.Copy ActiveWorkbook.Sheets(1).Range("A3")
__________________




All times are GMT +1. The time now is 12:30 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com