I am trying to add a code to open a workbook to the 'main menu' tab
The code I usually use is
But it seems to be conflicting with this code that is working perfectly on its own.
I'm sure it's something pretty simple, but I am a pretty simple guy!
Thanks for taking a look.
Rodger
The code I usually use is
Code:
Private Sub Workbook_Open()
Worksheets("main page").Activate
Application.DisplayFullScreen = True
End Sub
But it seems to be conflicting with this code that is working perfectly on its own.
Code:
Option Explicit
Private bRangeEdited As Boolean
Private WithEvents ws As Worksheet
Private Sub Workbook_Open()
Set ws = Range("InputRangeItems").Parent
End Sub
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim sMSG As String
sMSG = "This will lock the new Inventory Items and Prices you entered, and you won't be able to change them." & vbLf
sMSG = sMSG & "Do you want to go ahead ?"
If Not bRangeEdited Then GoTo Xit
If Not Me.ReadOnly Then
With Range("InputRangeItems")
If MsgBox(sMSG, vbExclamation + vbYesNo) = vbNo Then
Cancel = True
GoTo Xit
End If
.Parent.Unprotect ""
If .SpecialCells(xlCellTypeBlanks).Address <> .Address Then
.SpecialCells(xlCellTypeConstants).Locked = True
bRangeEdited = False
End If
.Parent.Protect ""
End With
End If
Xit:
End Sub
Private Sub ws_Change(ByVal Target As Range)
If Not Intersect(Range("InputRangeItems"), Target) Is Nothing Then
bRangeEdited = True
End If
End Sub
I'm sure it's something pretty simple, but I am a pretty simple guy!
Thanks for taking a look.
Rodger