View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Allowing for variable lines in macros

Basic approach:

Dim rng as Range, cell as Range
With ActiveWorkbook.worksheets(1)
set rng = .range(.cells(1,1),.cells(rows.count,1).End(xlup))
End With

for each cell in rng


Next

--
Regards,
Tom Ogilvy


"smurrock" wrote:

I am trying to set up a macro to run for a data file that will not have a
consistent number of lines each month. This seems like it should be simple,
however I am struggling. I tried using relative references but either I
didn't set it up right or it won't work. I also tried using offset which
also failed. This seems pretty basic??

Thanks!!
Sidonia