Changing the format of cells (eg: to currency, text, number etc)

Shaunym

New Member
Joined
Aug 29, 2008
Messages
31
Hi all,

I have a spreadsheet that is use to form tables using macros. However, Iuse the same spreadhseet for all the different tables I creat and a problem arises when for one report a column will have a cost in it (want the column or cells to be formated as currency).

Then a clear that and make another report and the old cost column has a account code in it that is amde up as numbers.

Unforunately due to the previous formatting the account code is changed to currency.

The question is: what vba code can I use, for example on column "A" of a spreadhseet that will change the format of that column to what i need. Such as number, currency, text etc.

Thanks in advance

Shaunym
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Try

Code:
Sub FmtA()
Dim response As String
response = InputBox("Enter General, Currency or Number")
With Columns("A")
    Select Case LCase(response)
        Case "general": .NumberFormat = "General"
        Case "currency": .NumberFormat = "$#,##0.00"
        Case "number": .NumberFormat = "#,##0.00"
    End Select
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,614
Members
449,090
Latest member
vivek chauhan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top