LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default ActiveWorkBook versus ActiveSheet

I have a macro that I would like to update every tab in the workbook, but I
can only get the one active sheet to update when I run the macro. I tried to
use two "FOR" staements but got an error. I want this macro to update every
sheet every time the workbook is opened. Here is my code. Any help would be
great as I rarely write macros so I am doing this by trial and error and
reading past posts. Thanks!

Sub Workbook_Open()
' This Macro will clear out the UNLOCKED cells of a sheet that is older
' than todays date by looking at the date cell in the spreadsheet
Dim cell As Range
With ActiveWorkbook
If Date Range("A1").Value Then
For Each cell In ActiveSheet.UsedRange
If Not cell.Locked Then cell.ClearContents
Next cell
End If
End With
End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveWorkbook.RefreshAll teepee[_3_] Excel Discussion (Misc queries) 0 November 11th 08 02:11 PM
Why doesn't While ActiveWorkBook < Null work? [email protected] Excel Discussion (Misc queries) 3 May 27th 07 12:05 AM
ActiveWorkbook.RefreshAll nc Excel Discussion (Misc queries) 0 March 21st 06 10:50 AM
ActiveWorkBook Pete Excel Discussion (Misc queries) 3 May 9th 05 04:14 PM
For Each wks In ActiveWorkbook.Worksheets bar a specific one? Pank Mehta Excel Discussion (Misc queries) 4 March 30th 05 04:53 PM


All times are GMT +1. The time now is 04:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"