Find the Header Row in a Sheet VBA

austinandrei

Board Regular
Joined
Jun 7, 2014
Messages
117
Hi,
This might be easy but I don't know how to look for the very first non-blank cell which pertains to the header on an entire sheet. My colleagues won't be giving me a file where the header is always in ROW 1. I know a code that can look on the very last non-blank cell in a column using a SINGLE VBA line and I want this to have an opposite function to look for the very first non-blank cell in a column.

This is the code I used for variable to look for the very last non-blank cell in column 1:
Code:
lastrow = Cells(Rows.Count,1).End(xlUp).Row
I need the same SINGLE LINE VBA CODE to have the opposite function to look for the very first non-blank cell in Column 1.
Thanks in advance!
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Try this.
Code:
FirstRow = Cells(1, 1).End(xlDown).Row
 
Upvote 0

Forum statistics

Threads
1,224,825
Messages
6,181,191
Members
453,021
Latest member
pingpong7117

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