VBA Print Conditioning

toughie

New Member
Joined
Oct 10, 2018
Messages
43
Hi folks,

I'm currently working on a user form which populates a worksheet and then prints, I am trying to add a question to the user form in which the user must answer correctly for the sheet to print. This is my current code which does not work

Private Sub CommandButton1_Click()
'populates worksheet'
Range("D5") = TextBox1.Value
Range("G5") = TextBox2.Value
Range("K5") = TextBox4.Value
Range("D7") = ComboBox1.Value
Range("G7") = ComboBox2.Value
Range("K7") = ComboBox3.Value

'Prints if correct revision number is present'

If Range("K8") = TextBox5.Value Then
ActiveSheet.PrintOut Copies:=TextBox3.Value

Else: MsgBox "Incorrect Revision"
End If

Can anyone see the error?

Many thanks in advance
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
You don't have a Textbox5 even listed in your variables? am I missing something?
 
Upvote 0
Hi,

Textbox5 is not a variable therefore it’s not listed, it is a box to answer a question, the question being what value is in cell (“K8”) the user just needs to enter the same number entered for the sheet to print

AT
 
Upvote 0

Forum statistics

Threads
1,214,923
Messages
6,122,283
Members
449,075
Latest member
staticfluids

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top