OK I need some serious help here, my head hurts trying to think of the best way to write this up and keep the code as small as possible, please let me explain...
My manager wanted me to update a completely non-functioning spreadsheet in which I did, but now wants me to add another tab in which a user can fill out information as well and I am running into issues. I will try to keep this short, how can I get the BeforePrint code below to function under the following parameters:
*Both tabs/sheets could be filled out and used by one user, so its possible I would need each MsgBox to show up when printing (is there a way to make the msgbox show up only if that tab is up and actively trying to be printed?) I am guessing if I put in something like
in theory this would mean they put in their name and if either cell was populated ,then I would know which msgbox was needed? or something like that.
*I don't want either of the cells to be empty, which is why I have the first statement to begin with, but with the new tab I have the new msgbox...it's possible and most likely that a user is only using one tab so I need it to be and/or option I am assuming?
Sorry if this is confusing to read, it is confusing to try and think of; and worse to write up
Might be best to enforce only using one tab at a time...hope to hear something back, please ask questions if needed it might help me to explain and think it out better.....been a really long day for this newbie on the VBA front hehe.
My manager wanted me to update a completely non-functioning spreadsheet in which I did, but now wants me to add another tab in which a user can fill out information as well and I am running into issues. I will try to keep this short, how can I get the BeforePrint code below to function under the following parameters:
*Both tabs/sheets could be filled out and used by one user, so its possible I would need each MsgBox to show up when printing (is there a way to make the msgbox show up only if that tab is up and actively trying to be printed?) I am guessing if I put in something like
Code:
If Sheet1.Cells(7, 2).Value <> "e.g. First Name Last Name" And Sheet5.Cells(6, 1).Value <> "e.g. First Name Last Name" Then...not sure what to follow
*I don't want either of the cells to be empty, which is why I have the first statement to begin with, but with the new tab I have the new msgbox...it's possible and most likely that a user is only using one tab so I need it to be and/or option I am assuming?
Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)[TABLE="width: 905"]
<tbody>[TR]
[TD="class: xl64, width: 905"][TABLE="width: 905"]
<tbody>[TR]
[TD]If Sheet1.Cells(11, 3).Value = "e.g. M-F" Then[/TD]
[/TR]
[TR]
[TD] MsgBox "Please Enter your normal working days in Section 6, thank you.", vbExclamation[/TD]
[/TR]
[TR]
[TD] Cancel = True[/TD]
[/TR]
[TR]
[TD] Exit Sub[/TD]
[/TR]
[TR]
[TD]End If
[TABLE="width: 905"]
<tbody>[TR]
[TD]If Sheet5.Cells(6, 6).Value = "e.g. M-F" Then[/TD]
[/TR]
[TR]
[TD] MsgBox "Please Enter your normal working days in Section 2, thank you.", vbExclamation[/TD]
[/TR]
[TR]
[TD] Cancel = True[/TD]
[/TR]
[TR]
[TD] Exit Sub[/TD]
[/TR]
[TR]
[TD]End If
End Sub[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
Sorry if this is confusing to read, it is confusing to try and think of; and worse to write up
Might be best to enforce only using one tab at a time...hope to hear something back, please ask questions if needed it might help me to explain and think it out better.....been a really long day for this newbie on the VBA front hehe.