Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy&paste a variable range rows and colums IK Excel Discussion (Misc queries) 1 August 30th 06 12:06 AM
Copying range to variable number of rows nospaminlich Excel Programming 2 December 1st 05 11:34 PM
count number of rows (variable range) Acid-Sky Excel Programming 3 August 23rd 05 10:06 AM
selecting range of cells - variable # of rows [email protected] Excel Programming 6 April 15th 05 02:10 PM
Delete all Rows in a Variable Range John[_78_] Excel Programming 3 June 30th 04 06:13 PM


All times are GMT +1. The time now is 08:03 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"