Find and Copy first non blank cell in Column AB

LNG2013

Active Member
Joined
May 23, 2011
Messages
465
Hello I need a little help with VBA to find the first non blank cell in column AB. It contains a date.

Then copy it to sheet "Date" into cell A1


Thank you in Advance
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
If you the sheet with the "AB" column you are looking at is the Active Sheet at the time of running this code, try this:
VBA Code:
    If ActiveSheet.Range("AB1") <> "" Then
        Sheets("Date").Range("A1").Value = ActiveSheet.Range("AB1").Value
    Else
        Sheets("Date").Range("A1").Value = ActiveSheet.Range("AB1").End(xlDown).Value
    End If
Otherwise, replace the "ActiveSheet" references with the specific sheet name.
 
Upvote 0
Solution
If you the sheet with the "AB" column you are looking at is the Active Sheet at the time of running this code, try this:
VBA Code:
    If ActiveSheet.Range("AB1") <> "" Then
        Sheets("Date").Range("A1").Value = ActiveSheet.Range("AB1").Value
    Else
        Sheets("Date").Range("A1").Value = ActiveSheet.Range("AB1").End(xlDown).Value
    End If
Otherwise, replace the "ActiveSheet" references with the specific sheet name.
That works wonderfully thank you.
 
Upvote 0
You are welcome.
Glad I was able to help!
 
Upvote 0

Forum statistics

Threads
1,215,453
Messages
6,124,930
Members
449,195
Latest member
Stevenciu

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