I have managed to find online, code to add the date into a cell depending on the properties of that cell which all works fine if I run the code from VB. Now I need to add this to a button command. I am sure this is simple to do but I cannot get it to work. I know how to create the button but I cannot adjust the code to make it work. My code is:
Sub X()
Dim lngRow As Long
Dim BotRow As Long
Cells(Rows.Count, "W").Select
Selection.End(xlUp).Select
BotRow = Selection.Row
For lngRow = 1 To BotRow
If UCase(Cells(lngRow, "W")) = "Y" Then
Cells(lngRow, "W") = Cells(lngRow, "W") & Format(Date, "mm-dd-yyyy")
End If
Next
End Sub
Any ideas would be gratefully received.
Cheers
Bookmarks