View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Crauwf Crauwf is offline
external usenet poster
 
Posts: 9
Default If statement in VBA to change formatting from % to numbers

Worked it out... sorry for anyone who looked at it!


"Crauwf" wrote:

I have column in a s/s where some numbers are currently formatted as a
percentage and others as a number, but i want to change them so that they are
formatted as numbers.

So for example in a column i have:-

A B (What i want it to return)
65% 65
63% 63
62 62
61% 61

I tried writing the below code, but VBA didn't like it....

Sub Macro2()

x = 1

Do Until Cells(x, 8).Value = ""

Cells(x, 8).Select

If Cells(x, 8).Format = "0.00%" Then

Selection.NumberFormat = "0.00"


End If

x = x + 1

Loop

End Sub

I realise that i would have to add a column and * all %'s by a hundred to
get my desired effect.

Could anyone help with my query.

Thanks! Crauwf.