i'm new here and to VBA and I need your assistance.
I have an excel spreadsheet with a dynamic table (Header is on Row 4). The data imported into the table contains a date values (5 September, 2018 6:11:17 PM EDT) that Excel cannot format to m-d-yyyy. the only way we can format the dates are to remove the 'comma', 'EDT' and 'EST' values. The macro runs and works as expected.
Now my challenge is to modify this macro (VBA) to look for the column header name instead of the whole column. As I keep getting asked to add a column to the table. The column names are 'Target Decomm Date', 'Actual Decomm Date', 'Created Date', 'Last Updated Date', 'Accreditation Date', and 'Accreditation Expiry Date'
All data is populated in row 5 and this is a dynamic table.
Here is my current code
Sub ConvertDateFormat()
'
' Macro1 Macro
'
' Keyboard Shortcut: Ctrl+Shift+D
'
Range("V:V,W:W,Z:Z,AA:AA,AC:AC,AD:AD").Select
Range("V5").Activate
Selection.NumberFormat = "m/d/yyyy"
Selection.Replace What:=",", Replacement:=" ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="EDT", Replacement:=" ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Selection.Replace What:="EST", Replacement:=" ", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
End Sub