Condensing a macro

  • Thread starter Thread starter fgwiii
  • Start date Start date
F

fgwiii

Would someone please provide me with the code to condense this so that the
formatting applies to all worksheets in the workbook regardless of the sheet
name?

Thank you!

Sheets("XVG001_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG002_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG003_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG004_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG005_20090727*.xls").Select
Rows("1:1").Select
Range("B1").Activate
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG006_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG007_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG008_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG009_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG010_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG012_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG013_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG014_20090727*.xls").Select
Rows("1:1").Select
Range("B1").Activate
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG015_20090727*.xls").Select
Rows("1:1").Select
Range("B1").Activate
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG016_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG017_20090727*.xls").Select
Rows("1:1").Select
Range("B1").Activate
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG018_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG019_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG020_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG021_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG022_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Sheets("XVG023_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG025_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG026_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG027_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
Sheets("XVG028_20090727*.xls").Select
Rows("1:1").Select
Selection.Font.ColorIndex = 2
Columns("E:E").Select
Selection.NumberFormat = "000000000000000 "
End Sub
 
Sub doshts()
For Each ws In Worksheets
ws.Rows(1).Font.ColorIndex = 3
ws.Columns("E:E").NumberFormat ="000000000000000"
Next ws
End Sub
 
Thanks!!

Don Guillett said:
Sub doshts()
For Each ws In Worksheets
ws.Rows(1).Font.ColorIndex = 3
ws.Columns("E:E").NumberFormat ="000000000000000"
Next ws
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 
Back
Top