Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() -----Original Message----- I have this code that is placing a formula in a range of cells if a control checkbox(cbExempt) is false. Then if cbExempt is true, it is clearing the contents of that same range of cells. I am getting a runtime error (1004):Application-defined or object-defined error when I run this code. The problem seems to be the line where it places the formula in the range of cells. At least that is the line that the debugger is highlighting. Any suggestions would be great. Thanks. Matt Public Sub Formula() If Worksheets("TIME AND LEAVE").cbExempt.Value = False Then Worksheets("TIME AND LEAVE").Range ("C31,E31,G31,I31,K31,M31,O31").Formula = "=IF(RC[1] < R[- 21]C[1],'ERROR','')" Else Worksheets("TIME AND LEAVE").Range ("C31,E31,G31,I31,K31,M31,O31").ClearContents End If End Sub . Try using .select then selection.clearcontents then range("a1").select to get back to a "home" position nath |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Visual Basic Error Run Time Error, Type Mismatch | Excel Discussion (Misc queries) | |||
Run time error 1004, General ODBC error | New Users to Excel | |||
How can I still go to the error-code after a On Error Goto? | Excel Programming | |||
Code Error - Run Time Error 5 (Disable Cut, Copy & Paste) | Excel Programming | |||
Code Run-time error '1004' | Excel Programming |