pells
02-12-2013, 05:21 PM
Please can anyone help?
I am trying to create code that if certain conditions are met in the workbook, after clicking on a button a message box is displayed with text and references to the sheet names of where the condition is met.
My code is below for my IF statement but I am struggling to find a way to show the sheetname in a message box if the IF condition is true:
If (ThisWorkbook.Worksheets("Week 01").Buttons("ReSubmit").Visible = True) Or _
(ThisWorkbook.Worksheets("Week 02").Buttons("ReSubmit").Visible = True) Or _
(ThisWorkbook.Worksheets("Week 03").Buttons("ReSubmit").Visible = True) Or _
(ThisWorkbook.Worksheets("Week 04").Buttons("ReSubmit").Visible = True) Then
MsgBox "This function is not avaiable whilst you have an impending re-submission of" & " " & INSERT SHEETNAME HERE, vbInformation, "Function Not Available"
Exit Sub
End If
Many thanks for taking the time to read my post and any help and assistance would be greatly received.
I am trying to create code that if certain conditions are met in the workbook, after clicking on a button a message box is displayed with text and references to the sheet names of where the condition is met.
My code is below for my IF statement but I am struggling to find a way to show the sheetname in a message box if the IF condition is true:
If (ThisWorkbook.Worksheets("Week 01").Buttons("ReSubmit").Visible = True) Or _
(ThisWorkbook.Worksheets("Week 02").Buttons("ReSubmit").Visible = True) Or _
(ThisWorkbook.Worksheets("Week 03").Buttons("ReSubmit").Visible = True) Or _
(ThisWorkbook.Worksheets("Week 04").Buttons("ReSubmit").Visible = True) Then
MsgBox "This function is not avaiable whilst you have an impending re-submission of" & " " & INSERT SHEETNAME HERE, vbInformation, "Function Not Available"
Exit Sub
End If
Many thanks for taking the time to read my post and any help and assistance would be greatly received.