Avatar of Fordraiders
Fordraiders
Flag 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
Microsoft OfficeVBAMicrosoft ExcelMicrosoft ApplicationsProgramming

Avatar of undefined
Last Comment
Fordraiders

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Shums Faruk

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Roy Cox

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
Fordraiders

ASKER
THANKS
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck