Lastrow in Range

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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,
 
try
Set rng = Range("h2:h" & cells(rows.count,"H").end(xlup).row)
 
One way, assuming no gaps in the data:

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

HTH
Jason
Atlanta, GA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top