I have a several columns in my excel worksheets which are all named as “Date”. I want to write a code which will find all date columns in all worksheets and format the values in that column as “dd/mm/yyyy;@” .
In the code below I tried writing Columns(“Date”).Select instead of Columns(“E:E”).Select but this is not working. Can anyone suggest me how to fix this?
Thanks for your time and suggestions.
Sub dateformat()
Dim ws As Worksheet
For Each ws In Worksheets
Columns("E:E").Select
Selection.NumberFormat = "dd/mm/yyyy;@"
Next ws
End Sub
Nupur, Is this what you are trying?
FOLLOWUP
The reason you are getting those errors is because your column is formatted as text. Try this. This works 🙂
HTH
Sid