Hi All,
I created the following Macro code which is used to clear a form. The code starts off with unprocteting the sheet then checking if a certain cells have images if so it deletes the images followed by doing some other stuff to clear others cells that have information in it.
The macro seems to work when the form is intially opened and clicked on straight away, but if a cell is selected and then the Macro is used it doesn't like it. A debug message pops up and the following line is highlighted in yellow.:![]()
Sub Macro3() ' ' Macro3 Macro ' Range("E3").Select Sheets("Form").Unprotect Password:="pass" Dim s As Shape, rng As Range Set rng = Range("O38:N38") For Each s In ActiveSheet.Shapes If Intersect(rng, s.TopLeftCell) Is Nothing Then Else s.Delete End If Next s Set rng = Range("AD27:AJ40") For Each s In ActiveSheet.Shapes If Intersect(rng, s.TopLeftCell) Is Nothing Then Else s.Delete End If Next s Sheets("Form").Protect DrawingObjects:=True, AllowFormattingColumns:=True, Contents:=True, Scenarios:=True, Password:="pass" Range("E3").Select ActiveCell.FormulaR1C1 = "1" Range("U6:AA6").ClearContents Range("U8:AA8").ClearContents Range("U10:AA10") = "[ Please select from list ]" Range("U11:AA12").ClearContents Range("U14:AA14").ClearContents Range("U16:AA16").ClearContents Range("C21:N26").ClearContents Range("C29:AA32").ClearContents Range("G34:Q34").ClearContents Range("Y34:AA34").ClearContents Range("Y38:AA38").ClearContents Range("G38:L38").ClearContents Range("G39:L39").ClearContents Range("Q21") = "Y" Range("Q22") = "Y" Range("Q23") = "Y" Range("Q24") = "Y" Range("Q25") = "Y" Range("Q26") = "Y" Range("V21:W21") = "[ Select ] " Range("V22:W22") = "[ Select ] " Range("V23:W23") = "[ Select ] " Range("V24:W24") = "[ Select ] " Range("V25:W25") = "[ Select ] " Range("V26:W26") = "[ Select ] " Range("X21:Z21") = "[ Select or Enter ]" Range("X22:Z22") = "[ Select or Enter ]" Range("X23:Z23") = "[ Select or Enter ]" Range("X24:Z24") = "[ Select or Enter ]" Range("X25:Z25") = "[ Select or Enter ]" Range("X26:Z26") = "[ Select or Enter ]" Range("AA21") = "[ Select or Enter ]" Range("AA22") = "[ Select or Enter ]" Range("AA23") = "[ Select or Enter ]" Range("AA24") = "[ Select or Enter ]" Range("AA25") = "[ Select or Enter ]" Range("AA26") = "[ Select or Enter ]" Range("AF34") = "FALSE" Range("AF39") = "FALSE" Range("AF40") = "FALSE" Range("AF41") = "FALSE" Range("V27") = "£ GBP" ActiveWindow.SmallScroll Down:=-42 Range("E3").Select ActiveCell.FormulaR1C1 = "" Range("C21:I21").Select End Sub
As always thank you for all your help. I don't know what I would do without you guys.![]()
If Intersect(rng, s.TopLeftCell) Is Nothing Then
Thanks











LinkBack URL
About LinkBacks
Register To Reply


Bookmarks