MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Need help with a couple simple VBA macros for Excel 97.


Posted by Jaakob on January 19, 2001 5:58 AM

I’m working in Excel 97 on Windows NT4.0.

I’m new to VBA so I only understand enough to patch things together and make minor edits to recorded macros.

I needed to Unprotect all worksheets in a variety of Excel files, and based on a couple other similar examples I found in this forum, I managed to cobble the following macro together. It seems to work okay. I'm not sure if it's the best way. Any suggestions?

Sub UnprotectAll()
'
' UnProtectAll Macro
' Macro recorded 1/17/01 by Jaakob
'
Dim WS
For Each WS In Worksheets
WS.Unprotect
Next
'
End Sub

More importantly, here‘s another, but related, problem I need to solve but haven’t yet figured out. I need to SelectAll and then impose "Normal font" for every worksheet in a workbook. Can anyone help me out?

Thanks in advance for any help you can give me.


Posted by Celia on January 19, 2001 4:41 PM

UnProtectAll Macro Macro recorded 1/17/01 by Jaakob


Dim ws As Worksheet
For Each ws In Worksheets
With ws.Cells.Font
.Name = "Arial"
.FontStyle = "Regular"
.Size = 10
End With
Next

Celia


Posted by Jaakob on January 19, 2001 4:58 PM

UnProtectAll Macro Macro recorded 1/17/01 by Jaakob


Thank you so much for your help.