Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
With VBA I would like to change the format of all cells in all
worksheets of a workbook to 'General' or 'Text'. How can this be done? Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
One way:
Dim ws As Worksheet For Each ws in ActiveWorkbook.Worksheets ws.Cells.NumberFormat = "General" ' or "@" for Text Next ws In article , wrote: With VBA I would like to change the format of all cells in all worksheets of a workbook to 'General' or 'Text'. How can this be done? Thanks. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub test()
For Each sht In Sheets sht.Cells.NumberFormat = "General" Next sht End Sub or Sub test() For Each sht In Sheets sht.Cells.NumberFormat = "@" 'for text Next sht End Sub " wrote: With VBA I would like to change the format of all cells in all worksheets of a workbook to 'General' or 'Text'. How can this be done? Thanks. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This should do it
Sub ChangeWorkbookFormat() Dim WS As Worksheet For Each WS In Worksheets WS.Range("1:" & WS.Rows.Count).NumberFormat = "General" Next End Sub Use "@" instead of "General" if you want the Text format. -- Rick (MVP - Excel) wrote in message ... With VBA I would like to change the format of all cells in all worksheets of a workbook to 'General' or 'Text'. How can this be done? Thanks. |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As others have pointed out, Cells is better to use than my
Range("1:"&WS.Rows.Count). -- Rick (MVP - Excel) "Rick Rothstein" wrote in message ... This should do it Sub ChangeWorkbookFormat() Dim WS As Worksheet For Each WS In Worksheets WS.Range("1:" & WS.Rows.Count).NumberFormat = "General" Next End Sub Use "@" instead of "General" if you want the Text format. -- Rick (MVP - Excel) wrote in message ... With VBA I would like to change the format of all cells in all worksheets of a workbook to 'General' or 'Text'. How can this be done? Thanks. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Format Change in Shared Workbook | Excel Worksheet Functions | |||
Change date format throughout workbook | Excel Discussion (Misc queries) | |||
Change format to landscape for whole workbook at once | Excel Worksheet Functions | |||
EXCEL Workbook tab format options: change color or font | Excel Discussion (Misc queries) | |||
Change format of cells | Excel Worksheet Functions |