Link to home
Start Free TrialLog in
Avatar of Fordraiders
FordraidersFlag for United States of America

asked on

Need a check on Columns and cells for empty/null cells past a column header

Need a check on cells for empty/null cells  past a column header

vba excel 2010

I have this code trying to count my rows:  The data will either be in Column 1(a)   Or Column 2(b)
While Len(.Cells(lastRow, 1)) > 0 Or Len(.Cells(lastRow, 2)) > 0
                lastRow = lastRow + 1
Wend
The column Header are always in rows 3

Sometimes in Column1 the cells will be empty and i need to calculate the rows in Column2
Both Column cells will never be both filled in:

Will always look like this:
Column1            Column2
account              track       <----   row 3
11111
22321
445436

Or
Column1            Column2
account              track           <----   row 3
                            32de4
                            656768yu
                           65tgty

The code above seems ok(working), just wanting to make sure

Thanks
fordraiders
ASKER CERTIFIED SOLUTION
Avatar of Shums Faruk
Shums Faruk
Flag of India 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
Why not use a formula? COUNTBLANK returns a count of empty cells in a range

=COUNTBLANK(Range)

COUNTBLANK function

The above would be dynamic if you used a Table with a Total Row
Avatar of Fordraiders

ASKER

THANKS