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

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
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,223,237
Messages
6,170,928
Members
452,366
Latest member
TePunaBloke

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