View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chrissy[_4_] Chrissy[_4_] is offline
external usenet poster
 
Posts: 101
Default Formatting Date Macro

Sub formatDateCols()
Dim c As Range

For Each c In ActiveSheet.Range("1:1")
If c = "Date" Then
c.EntireColumn.NumberFormat = "dd/mm/yy"
End If
Next
End Sub


You only need to ask once.

Chrissy.


Sarah wrote
I need to be able to create a macro thast looks for the
column header Date on row 1 and format this entire column
into the date format dd/mm/yy.

The only way I have been able to do this at the moment is
by recording the macro when highlighting all these columns
manually and formatting them. This however only works
because I select the columns myself.

Is there anyway this can work looking for the column
header of Date rather than me having to select them?

Any help would be appreciated - thanks