Hi All,
I'm sure this is really simple but I just can't figure out what's wrong
I have a small piece of code in the 'ThisWorkbook' module that changes a specific cell from FALSE/TRUE whenever the workbook is saved
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Range("N149").Select
ActiveCell.FormulaR1C1 = "FALSE"
End Sub
----------------------------------------------------------------------------
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
Range("N149").Select
ActiveCell.FormulaR1C1 = "TRUE"
End Sub
Unfortunately this code executes on whichever sheet I am on at the time
How can I specify which sheet this should run on?
I've tried the following
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Sheets("INV & CRN").Range("N149").Select
ActiveCell.FormulaR1C1 = "FALSE"
End Sub
But this gives "Runtime error 1004 - select method of range class failed"
And also
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
With ThisWorkbook.Sheets("INV & CRN")
Range("N149").Select
ActiveCell.FormulaR1C1 = "FALSE"
End With
End Sub
But this still executes on the active sheet rather than sheet4 ("INV & CRN") 
Any help would be appreciated
Kind regards
V
Bookmarks