ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Update Format of cells in multiple worksheets (https://www.excelbanter.com/excel-programming/336886-update-format-cells-multiple-worksheets.html)

AliH

Update Format of cells in multiple worksheets
 
I have a number of worksheets - all the same layout. There are 3 cells that
I wish to be formatted to Number, 2 decimal places and comma separator eg
1,200.00

Is it possible to do this automatically? if yes how?



Norman Jones

Update Format of cells in multiple worksheets
 
Hi AliH,

One way:

'============================
Public Sub TryIt()

Dim wb As Workbook
Dim sh As Worksheet
Dim arr As Variant
Dim i As Long

arr = Array("Sheet1", "Sheet2", "Sheet4") '<<=== CHANGE

For i = LBound(arr) To UBound(arr)
Sheets(arr(i)).Range("A10").NumberFormat = "0.00"
' <<===== CHANGE RANGE
Next

End Sub
'<<========================


---
Regards,
Norman



"AliH" wrote in message
...
I have a number of worksheets - all the same layout. There are 3 cells
that
I wish to be formatted to Number, 2 decimal places and comma separator eg
1,200.00

Is it possible to do this automatically? if yes how?






All times are GMT +1. The time now is 12:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com