I am trying to populate the date and have it populate the column until the last row of data. However it doesn't seem to populate to the last line of data and I don't understand why. What is wrong with my code?
Sub updatedate()
lastRow = Range("F" & Rows.Count).End(xlUp).Row
Range("F2:F" & lastRow) = Date
Range("F2:F" & lastRow).Style = "Normal"
Range("F2:F" & lastRow).Value = Format(Date, "yyyymmdd")
End Sub
the date in format yyyymmdd to be updated and populated on each row until last in column F
The problem is on the line
lastRow = Range("F" & Rows.Count).End(xlUp).Row
If you change "F"
to "A"
(or any other suitable column) it will work better. The last used cell in the F column is not yet used.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.