I am trying to format an area from j2:aj2. Within this range, for each row the has "Price" in column "J" I need that row to be formatted as "currency", and every other row should be formatted as "comma without decimal places".
I have tried to develop the VBA code shown below to do this, but it is not working.
Can anybody help me? This is driving me crazy!
dyana
Dim myRow As Long
Dim myStop As Long
Dim myRange As Range
Sheets("sheet1".Select
myStop = Range("L2".CurrentRegion.Rows.Count
For myRow = 1 To myStop
Do Until myRow = ""
If Cells(myRow, 1) = "Price" Then
Selection.Style = "Currency"
Else
Selection.NumberFormat = "#,##0_);(#,##0)"
End If
Loop
End Sub
I have tried to develop the VBA code shown below to do this, but it is not working.
Can anybody help me? This is driving me crazy!
dyana
Dim myRow As Long
Dim myStop As Long
Dim myRange As Range
Sheets("sheet1".Select
myStop = Range("L2".CurrentRegion.Rows.Count
For myRow = 1 To myStop
Do Until myRow = ""
If Cells(myRow, 1) = "Price" Then
Selection.Style = "Currency"
Else
Selection.NumberFormat = "#,##0_);(#,##0)"
End If
Loop
End Sub