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

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

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,213,557
Messages
6,114,287
Members
448,562
Latest member
Flashbond

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