Sub Format()
Dim lngCol As Long, i As Long
Dim str As String
lngCol = Cells(2, Columns.Count).End(xlToLeft).Column
For i = 1 To lngCol
Select Case Cells(2, i)
Case "$": Columns(i).Style = "Currency"
Case "%": Columns(i).Style = "Percent"
End Select
Next
End sub
Public Sub FormatCellsBasedOnString()
Dim lngToCol As Long, lngCol As Long, lngToRow As Long
With Sheet1
lngToCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
For lngCol = 1 To lngToCol
lngToRow = .Cells(.Rows.Count, lngCol).End(xlUp).Row
.Range(.Cells(3, lngCol).Address & ":" & .Cells(lngToRow, lngCol).Address).NumberFormat = .Cells(2, lngCol)
Next
End With
End Sub