VBA Magician required again

mikemcbain

Board Regular
Joined
Nov 14, 2005
Messages
152
Office Version
  1. 365
Platform
  1. Windows
I have had such success on this Forum that I will cheekily test your generosity once again!

Each day I import several hundred rows of data in columns A:K of a xlsm workbook interspersed randomly with blank rows and I must manually put today's Date into Column O:O of each row containing data.

Would some wizard produce a little VBA code for me that I can use to insert today's date into Column O:O?

I would like to add it to the end of the macro that imports the other data to this workbook.

I use Office 365 and Windows 10 and I am 82yo and starting to slow up.

Mike.
 
Change
Code:
If cell.Value <> "" Then cell.Offset(, 4).Value = Date
To
Code:
If cell.Value <> "" And cell.Offset(, 4).Value = "" Then cell.Offset(, 4).Value = Date
and see if that does what you need.
 
Upvote 0

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
So just change the number in red to the row you want to start the code

Code:
Sub MM1()
Dim cell As Range
For Each cell In Range("K[b][color=red]1[/color][/b]", Cells(Rows.Count, "K").End(xlUp))
If cell.Value <> "" Then cell.Offset(, 4).Value = Date
Next cell
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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