theotherside
New Member
- Joined
- Jun 9, 2015
- Messages
- 2
The data in my worksheet is being stored in the database as a timestamp even though it's a date. When i pull the data and copy it over i need a quick way to look through multiple sheets for a defined header or column and format it from timestamp to date. the below example does exactly that but only for the first worksheet in the workbook:
Code:
Sub Format_Date_Columns()
Dim arr As Variant, ndx As Integer, wkst As Worksheet
arr = Array("START_DATE", "END_DATE", "DOH")
For ndx = LBound(arr) To UBound(arr)
Set Found = Rows("1:1").Find(arr(ndx), SearchDirection:=xlNext, MatchCase:=False)
If Not Found Is Nothing Then
Found.EntireColumn.NumberFormat = "mm/dd/yyyy"
End If
Next ndx
End Sub