What object for an Excel cell

  • Thread starter Thread starter Sean
  • Start date Start date
S

Sean

Hi,

I would like to use two variables to step through an Excel Worksheet. What
object type would I use for this. Ideally, I would like to use a set up like
the following:

CurrentCell, NextCell As __________

Set CurrentCell = ActiveSheet._____________
Set NextCell = ActiveSheet._____________

Do
stuff for CurrentCell
NextCell = Offset CurrentCell (1,0)
CurrentCell = NextCell
While
Not IsNull CurrentCell
Loop

Thanks much
Sean
 
Try something such as this:


Dim CurrentCell As Excel.Range
Set CurrentCell = ActiveSheet.Range("A1")

Do While IsNull(CurrentCell.Value) = False
stuff for CurrentCell

Set CurrentCell = CurrentCell.Offset(1,0)

Loop
 
Back
Top