auto format 5 worksheets out of 6 when opening excel spreadsheet.

G

Guest

to all:

I'm trying to auto format 5 worksheets that are in my
workbook, but don't want the sixth worksheet formated.
So, I want worksheet1 to remain static and worksheet2 -
worksheet6 to be auto formated with my macro when opening
up the excel spreadsheet.

Below is what I've been using for an excel spreadsheet
that has only two worksheets in it:

Public Sub Auto_Open()
On Error Resume Next ' In case there are no blanks
Columns("A:A").SpecialCells
(xlCellTypeBlanks).EntireRow.Delete
ActiveSheet.UsedRange 'Resets UsedRange for Excel 2002
lastrow = ActiveSheet.UsedRange.Row - 1 +
ActiveSheet.UsedRange.Rows.Count
' MsgBox (lastrow)
totalrows = lastrow - 1
lastrow = lastrow + 2
cellm1 = "A" & lastrow
cellm2 = "B" & lastrow
Sheet2.Cells.Range(cellm1, cellm2).Merge
Sheet2.Cells(lastrow, 1).Value = "Total Records"
Sheet2.Cells(lastrow, 3).Value = totalrows
Sheet2.UsedRange.AutoFormat (xlRangeAutoFormatList1)
End Sub

the above macro formats worksheet2 only, how would I
adopt this to automatically format 5 worksheets when
opening up my excel spreadsheet?

Any help would be great and thanks in advance!

Mike
 
J

J.E. McGimpsey

See one reply in worksheet.functions (though this group was the
appropriate group to post your question in).

Please don't post the same message to different groups - it tends to
fragment your answers, and possibly waste the time of those
answering questions that already have replies.

For tips on how to use these groups effectively, please see

http://cpearson.com/excel/newposte.htm
 

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

Top