Condensing a macro

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
 
D

Don Guillett

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

fgwiii

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top