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

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Try this.
Code:
FirstRow = Cells(1, 1).End(xlDown).Row
 
Upvote 0

Forum statistics

Threads
1,216,037
Messages
6,128,440
Members
449,453
Latest member
jayeshw

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