Hi
I am very new to what excel can do and am learning as I go so sorry if this is a daft question or the code is completely wrong.
I have put together the following code, using posts on this site, which works for the one worksheet ("one") however I can not get it to work across all the work sheets, (there are 16 in total). I have tried various ways found on the net but nothing seems to work, I think due to my lack of knowledge. Each worksheet is a number ie one, two, three etc.
Any help word be appreciated.
Private Sub Workbook_Open()
Dim ThisCell1 As Range
Dim ThisCell2 As Range
For Each ThisCell1 In Worksheets("one").Range("M10:M20")
For Each ThisCell2 In Worksheets("one").Range("M6")
If ThisCell1.Value = ThisCell2.Value Then
Worksheets("one").Range("M1").Value = month(Date) - 1
Exit For
End If
Next ThisCell2
Next ThisCell1
End Sub
I am very new to what excel can do and am learning as I go so sorry if this is a daft question or the code is completely wrong.
I have put together the following code, using posts on this site, which works for the one worksheet ("one") however I can not get it to work across all the work sheets, (there are 16 in total). I have tried various ways found on the net but nothing seems to work, I think due to my lack of knowledge. Each worksheet is a number ie one, two, three etc.
Any help word be appreciated.
Private Sub Workbook_Open()
Dim ThisCell1 As Range
Dim ThisCell2 As Range
For Each ThisCell1 In Worksheets("one").Range("M10:M20")
For Each ThisCell2 In Worksheets("one").Range("M6")
If ThisCell1.Value = ThisCell2.Value Then
Worksheets("one").Range("M1").Value = month(Date) - 1
Exit For
End If
Next ThisCell2
Next ThisCell1
End Sub