#1   Report Post  
Jeff
 
Posts: n/a
Default Lastrow in Range

Hello,

This is the VBA macro that I use:
Set rng = Range("h2:h167")
For Each cell In rng
If IsNumeric(cell.Value) Then
cell.Value = Application.WorksheetFunction. _
RoundDown(cell.Value, 2)
End If
Next
I'd like to set the rng to automatically start from H2 to the last row in
column H.
Thanks,

  #3   Report Post  
Jason Morin
 
Posts: n/a
Default

One way, assuming no gaps in the data:

Set rng = Range("H2:H" & Range("H2").End(xlDown).Row)

HTH
Jason
Atlanta, GA

-----Original Message-----
Hello,

This is the VBA macro that I use:
Set rng = Range("h2:h167")
For Each cell In rng
If IsNumeric(cell.Value) Then
cell.Value = Application.WorksheetFunction. _
RoundDown(cell.Value, 2)
End If
Next
I'd like to set the rng to automatically start from H2

to the last row in
column H.
Thanks,

.

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
Passing a range name as an argument to the Index Function Michael Sharpe Excel Discussion (Misc queries) 3 September 5th 12 01:33 PM
named range refers to: in a chart Spencer Hutton Excel Discussion (Misc queries) 1 December 14th 04 10:15 PM
HTML_Control Range name Steven Cheng Excel Discussion (Misc queries) 4 December 10th 04 10:12 PM
Invalid Range Name JSTLB0605 Excel Discussion (Misc queries) 5 December 3rd 04 05:10 PM
Macro for Show/Hide Range Bill Excel Discussion (Misc queries) 3 December 1st 04 05:33 PM


All times are GMT +1. The time now is 12:41 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"