Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Variable range of rows
So you can copy the visible rows elsewhere???
Option Explicit Sub testme() Dim RngToCopy As Range With Worksheets("Sheet1") With .AutoFilter.Range Set RngToCopy = Nothing On Error Resume Next Set RngToCopy = .Resize(.Rows.Count - 1, .Columns.Count) _ .Offset(1, 0).Cells.SpecialCells(xlCellTypeVisible) On Error GoTo 0 End With End With If RngToCopy Is Nothing Then 'no visible rows--except the header Else RngToCopy.Copy _ Destination:=Worksheets("sheet2").Range("a1") End If End Sub It copies the details--not the header. Dirk wrote: Can someone help me with the following : In a macro I use autofilter for columns A to I. This range of columns doesn't change. But the rows do. Sometimes there are 80 rows, sometimes there are 200 or even more rows. How can I realise this in a macro ? Many thanks for your reply. -- Dirk ------------------------------------------------------------------------ Dirk's Profile: http://www.msusenet.com/member.php?userid=6449 View this thread: http://www.msusenet.com/t-1873649102 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to copy&paste a variable range rows and colums | Excel Discussion (Misc queries) | |||
Copying range to variable number of rows | Excel Programming | |||
count number of rows (variable range) | Excel Programming | |||
selecting range of cells - variable # of rows | Excel Programming | |||
Delete all Rows in a Variable Range | Excel Programming |