W
Wanna Learn
Hello I want to clear some cells everytime the workbook is opened. the
cells are found in a worksheet "Form"
this is the code - does not do anything when I open the workbook thanks
Private Sub Workbook_Open()
If TypeName(SH) = "Form" Then
Range("D7:F7").Select
Selection.ClearContents
Range("C11").Select
Selection.ClearContents
Range("D13").Select
Selection.ClearContents
Range("G13:I13").Select
Selection.ClearContents
Range("D15").Select
Selection.ClearContents
Range("D17").Select
Selection.ClearContents
Range("D19:J19").Select
Selection.ClearContents
Range("D21:I21").Select
Selection.ClearContents
Range("D25").Select
Selection.ClearContents
Range("C29:J29").Select
Selection.ClearContents
Range("C31:J31").Select
Selection.ClearContents
Range("C33:J33").Select
Selection.ClearContents
Range("C35:J35").Select
Selection.ClearContents
Range("C37:J37").Select
Selection.ClearContents
Range("C3939").Select
Selection.ClearContents
Range("G39").Select
Selection.ClearContents
Range("J39").Select
Selection.ClearContents
Range("D41").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=21
Range("D56").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=-21
Range("D7:F7").Select
End If
End Sub
cells are found in a worksheet "Form"
this is the code - does not do anything when I open the workbook thanks
Private Sub Workbook_Open()
If TypeName(SH) = "Form" Then
Range("D7:F7").Select
Selection.ClearContents
Range("C11").Select
Selection.ClearContents
Range("D13").Select
Selection.ClearContents
Range("G13:I13").Select
Selection.ClearContents
Range("D15").Select
Selection.ClearContents
Range("D17").Select
Selection.ClearContents
Range("D19:J19").Select
Selection.ClearContents
Range("D21:I21").Select
Selection.ClearContents
Range("D25").Select
Selection.ClearContents
Range("C29:J29").Select
Selection.ClearContents
Range("C31:J31").Select
Selection.ClearContents
Range("C33:J33").Select
Selection.ClearContents
Range("C35:J35").Select
Selection.ClearContents
Range("C37:J37").Select
Selection.ClearContents
Range("C3939").Select
Selection.ClearContents
Range("G39").Select
Selection.ClearContents
Range("J39").Select
Selection.ClearContents
Range("D41").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=21
Range("D56").Select
Selection.ClearContents
ActiveWindow.SmallScroll Down:=-21
Range("D7:F7").Select
End If
End Sub