Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default If statement in VBA to change formatting from % to numbers

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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel change a group of positive numbers to negitive numbers Clare Jones Excel Discussion (Misc queries) 3 July 2nd 09 04:25 PM
How to change positive numbers to negative numbers without re-ente 9541moosegirl Excel Worksheet Functions 8 March 5th 08 05:35 PM
Excel, change column of negative numbers to positive numbers? Nita New Users to Excel 3 November 27th 07 04:54 AM
Can I change a column of calculated numbers to absolute numbers? Kate Bissell Excel Discussion (Misc queries) 3 October 25th 06 06:10 PM
change 2000 cells (negative numbers) into positive numbers lisbern Excel Worksheet Functions 2 August 16th 06 05:54 PM


All times are GMT +1. The time now is 04:21 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"