Pinaceous
Well-known Member
- Joined
- Jun 11, 2014
- Messages
- 1,124
- Office Version
- 365
- Platform
- Windows
Hi All,
I'm working with a workbook where it opens up to a specific sheet# based upon the current month.
For example, if it is:
October it opens up to Sheet1
.
.
.
September it opens up to Sheet 12
in using this code:
Now my question is, I'd like to create a new sub to lock the prior month's sheet from editing.
So, for example, now being September of my workbook's Sheet12, I'd like it to lock the prior month's sheet being August of Sheet11.
The new sub will have to exclude October (Sheet1) because it is my starting month.
Can you help me?
Thank you,
pinaceous
I'm working with a workbook where it opens up to a specific sheet# based upon the current month.
For example, if it is:
October it opens up to Sheet1
.
.
.
September it opens up to Sheet 12
in using this code:
VBA Code:
Sub MonthSheetSelect()
Dim shtname As String
Dim thismonth As Long
thismonth = Month(Now())
If thismonth = 11 Or thismonth = 12 Then
thismonth = thismonth - 6
Else
thismonth = thismonth + 6
End If
Worksheets(thismonth).Select
End Sub
Now my question is, I'd like to create a new sub to lock the prior month's sheet from editing.
So, for example, now being September of my workbook's Sheet12, I'd like it to lock the prior month's sheet being August of Sheet11.
The new sub will have to exclude October (Sheet1) because it is my starting month.
Can you help me?
Thank you,
pinaceous