hello - I have this code that someone on this formn provided and it was working last week...now I'm getting a Run Time Error 1004 Method 'Undo' of Object _Application' failed. Basically this code should allow only edits in columns 7, 12 and 16.
Here is the code:
Option Explicit
Private Sub Workbook_SheetChange(ByVal sh As Object, ByVal Target As Range)
Select Case Target.Column
Case 7, 12, 16
'nothing, these columns are fine
Case Else
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
MsgBox "This column is not availabe for editing"
sh.Range("a2").Select
End Select
End Sub
An additional question, i have two other codes in the ThisWorkbook (one is Workbook_open() and the other is BeforeClose(). I'm assuming that I can have all three in the ThisWorkbook module, yes?
UPDATE - - I went back to the other two OPEN and BEFOREClose codes and removed any type of updating, I had in the OPEN code to clear out cell value of B505. Deleted that line. The Run Time error is gone, but now the Change Code (shown above) just doesn't fire? Any suggestions on what might be missing??? Thanks!
Bookmarks