Return Row Number of First non blank cell using Subtotaling RowLevels:=2

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,486
In my Table Row 1 comprises my Header Info. Once I run the Subtotal routine and then select the RowLevels:=2 (Manually), how can I (using VBA/code) determine the EXCEL ROW NUMBER of the First non-blank record. I'm at a loss after googling for Over and hour. Can anyone assist? Thanks in Advance.. Jim
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Return Row Number of First non blank cell
We set up a range variable with the name lookAt
Code:
Dim lookAt as Range
To check the value of lookAt, we simply query its Value attribute
Code:
If lookAt.Value <> vbNullString then MsgBox = lookAt.row
The interesting part is telling VBA where on the spreadsheet to look
If we are searching a range of cells like A1:C3 we could do something like this
Code:
Dim lookIN as Range
Set lookIN = Range(Cells(1, 1), Cells(3, 3))
'Then we iterate Look IN
For each lookAt in lookIN
    if lookAt.value <> vbNullString then MsgBox = lookAt.row
Next lookAt
That should get you started
 
Upvote 0
You can also use the built in function: End(xlDown).Row

Just change the Range below to match the beginning cell and it will jump down to the next populated cell. You can to this in any direction Up, Down, Left, Right

NextRowDown = Range("A1").End(xlDown).Row
 
Upvote 0

Forum statistics

Threads
1,213,565
Messages
6,114,338
Members
448,570
Latest member
rik81h

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top