LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do I select this range using code....another try at it.

The only way i know of to do it and be absolutely sure that it i
correct



Sub Macro1()
Dim i As Integer
Dim r As Long
Dim t As Long
For i = 1 To 5 Step 1
t = Cells(65536, i).End(xlUp).Row
If t r Then
r = t
End If
Next i
If r 1 Then
Range("a2:e" & r).Select
End If
End Sub


you could also use

If rows have nbeen deleted from the bottom of you sheet this wil
include those deleted rows in the row so you could end up with severa
blank rows at the bottom selected

sub Macro2
dim r as long
r=Range("a1").SpecialCells(xlLastCell).Row
range("a2:e" & r).select)
end sub

If rows have nbeen deleted from the bottom of you sheet this wil
include those deleted rows in the row so you could end up with severa
blank rows at the bottom selecte

--
Message posted from http://www.ExcelForum.com

 
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
CODE 2 SELECT SHEETS LISTED IN A RANGE Faraz A. Qureshi Excel Discussion (Misc queries) 1 July 30th 09 07:31 AM
How can change range to select active rows instead of :=Range("S10 ldiaz Excel Discussion (Misc queries) 7 August 29th 08 03:52 PM
Code to select range Shawn Excel Discussion (Misc queries) 1 June 2nd 05 05:14 PM
How do I select this range using code? TBA[_3_] Excel Programming 2 January 14th 04 09:28 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 11:30 AM.

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

About Us

"It's about Microsoft Excel"