Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP! - There's a problem with my Formatting Code

Status
Not open for further replies.

dyana

Technical User
Mar 26, 2002
27
US
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
 
Disregard this thread.

LSTAN helped me out with it.

dyana
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top