Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Changin Cell Formats using VBA
Hey Guys.
I was wondering if someone could help me. I am writing VB code for a budgetary and forecasting tool. I have the code written to do the analysis, and then create a summary table with all the information in it. However, the cells are formatted correctly so each time I run it, I have make some cosmetic changes. I know you can do this using VB, but I do not know how. I need to: - Change the format of a range from a number to currency. - Change the format of a range from a number to a percentage. - Add all around borders for a range. I greatly appreciate any assistance you could provide. Thanks, -Michael |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Changin Cell Formats using VBA
Using the Macro Recorder:
Sub Macro2() Range("G1").Select Selection.NumberFormat = "$#,##0.00" Range("G2").Select Selection.NumberFormat = "0.00%" Range("G1:G2").Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With Selection.Borders(xlInsideHorizontal).LineStyle = xlNone End Sub -- Gary's Student "Michael" wrote: Hey Guys. I was wondering if someone could help me. I am writing VB code for a budgetary and forecasting tool. I have the code written to do the analysis, and then create a summary table with all the information in it. However, the cells are formatted correctly so each time I run it, I have make some cosmetic changes. I know you can do this using VB, but I do not know how. I need to: - Change the format of a range from a number to currency. - Change the format of a range from a number to a percentage. - Add all around borders for a range. I greatly appreciate any assistance you could provide. Thanks, -Michael |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy cell format to cell on another worksht and update automatical | Excel Worksheet Functions | |||
Reveal cell formats and extendable range in tool/statusbar/icon. | Excel Worksheet Functions | |||
Changing Cell formats to date fields automatically | Excel Worksheet Functions | |||
Can't open doc. Too many different cell formats. | Excel Discussion (Misc queries) | |||
How do I find out how many different cell formats an existing wor. | Excel Discussion (Misc queries) |