Autofill Question

RHONDAK72

Board Regular
Joined
Dec 26, 2007
Messages
133
Hi. I use Excel 2010. I want to write some code that will look at the cell in column A. If the cell is not blank, then the column B value will fill in with the current date. Is there a way to just write the code to get the current date to autofill downward in Column B until column A is blank? Or, would I need to do some sort of an if/then statement that loops until the column A value is blank? Any code suggestions or examples are much appreciated.

Example Result:

Row Column A Column B
1 Comment 1 4/10/2014
2 Comment 2 4/10/2014
3 Comment 3 4/10/2014
4 Comment 4 4/10/2014
5 Comment 6 4/10/2014
6
7
8
9
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try

Code:
Sub test()
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("B1:B" & LR).Value = Date
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,133
Messages
6,123,233
Members
449,092
Latest member
SCleaveland

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