Since I fix dates daily, I was tired of copy and pasting formula so I created a loop. (I did start my word formula book)
Here it is, I prompt for column of dates and where to put fixed dates or overwrite them.
Sub FixDatesForReports()
Dim DateNumcol As Integer
Dim FixDateCol As Integer
Dim isnumber As Long
Dim MyCol As Long
Dim FinalRow As Long
Dim i As Long
Application.ScreenUpdating = False
On Error Resume Next
MyCol = ActiveCell.Column
DateNumcol = Application.InputBox(Prompt:="Enter Column Number where the Dates need to be fixed", Default:=MyCol, Type:=1)
FixDateCol = Application.InputBox(Prompt:="Enter Column Number where you wantfixed dates to be entered in", Default:=MyCol, Type:=1)
FinalRow = Cells(Rows.Count, DateNumcol).End(xlUp).Row
On Error Resume Next
FinalRow = Cells(Rows.Count, DateNumcol).End(xlUp).Row
For i = 2 To FinalRow
Cells(i, FixDateCol).Value = "=--TEXT(R[0]C[-1],LOOKUP(LEN(R[0]C[-1]),{4,5,7},{""0-0-00"",""0-00-00"",""0-00-0000""}))"
Next i
Application.ScreenUpdating = True
End Sub
Two things I want to work on.
1. Copying result in cell not the formula (so I do not have to copy and paste as values
2.They threw in another Date Day,Month 52016 with no day, just month and Year.
any additional input would be greatly appreciated to work with this great formula from Shg
Bookmarks