View Single Post
  #2 (permalink)  
Old February 29th, 2012, 10:22 PM
Shasur Shasur is offline
Friend of Wrox
Points: 3,060, Level: 23
Points: 3,060, Level: 23 Points: 3,060, Level: 23 Points: 3,060, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2005
Location: , , .
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

You can try something like this

Code:
i1 = ActiveWorkbook.Worksheets("Sheet1").Cells.SpecialCells(xlCellTypeLastCell).Row
SetRange Range("A1:N" & i1)
SpecialCells is one way to identify the last used cell in a sheet.

There are otherways like UsedRange, xlEnd etc

Cheers
Shasur
__________________
C# Code Snippets (http://www.dotnetdud.blogspot.com)

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
Reply With Quote
The Following User Says Thank You to Shasur For This Useful Post:
J.Suzuki (March 30th, 2012)