View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Need macro to clear contents

Hi Steve,

Do I need to replace "ThisWorkbook.Worksheets("Sheet1")"
with the names of my workbook & sheets?


The ThisWorkbook property returns the workbook holding the code and,
therefore, requires no change.

Replace Sheet1 with the name of the sheet of interest.


---
Regards,
Norman



"steve_sr2" wrote in message
...
Do I need to replace "ThisWorkbook.Worksheets("Sheet1")" with the names of
my
workbook & sheets?


"Tom Ogilvy" wrote:

in the VBE, go to the project explorer and double click on the
ThisWorkbook
entry for your workbook/project

In the resulting module, in the dropdowns at the top select Workbook form
the left and Open from the right. This places

Private Sub Workbook_Open()

End Sub

in the module. Put your code here

Private Sub Workbook_Open()
With ThisWorkbook.Worksheets("Sheet1")
.Range("B9,F1,G3:H10,M11").ClearContents
End With
End Sub


--
Regards,
Tom Ogilvy


"steve_sr2" wrote in message
...
I need to create a macro to clear certain fields when sheet in workbook
is
opened.

Thanks for the help!