Link to home
Start Free TrialLog in
Avatar of keats88
keats88

asked on

More efficient code using "with class" and .Cells, .Range, etc.? Excel, VBA

I'm trying to find more efficient methods for iterating through multiple row values in multiple workbooks. I think this is best illustrated through some code:

with data
  If .Cells(.Range("custom_name").Row + i, .Range("custom_name").Column) > Date then
    do something here
  end if
end with

Open in new window


Basically...I'm looking for a way to be able to start my "with" statement with data.Range and then back track into .Cells

...or find a different way to call a specific cell without the above .Cells(.Range1.Row, .Range2.Row) syntax, which is currently making my code extremely dense.
ASKER CERTIFIED SOLUTION
Avatar of zorvek (Kevin Jones)
zorvek (Kevin Jones)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
One way of iterating thru a range without having to go thru heavy repettitive syntax is to do something like this

For each Cell in Data.Cells(Data.Range("custom_name").Row + i, Data.Range("custom_name").Column)

if Cell > Date then
 do something
Next Cell

gowflow
Avatar of keats88
keats88

ASKER

Great information, thank you!