Printing from Userform specific

Shacalul

New Member
Joined
Mar 8, 2015
Messages
6
Hi,

I`m a beginner in VBA, but I`m trying to make my work more easily.

I have an excel sheet, when changing the number in cell AB1 is pasting different data corresponding with the number inserted in AB1 from another sheet.
I have an user-form inserting minimum and maximum number. Starting from minimum number I want to change in cell AB1 and print 2 copies, until maximum number included. Lets say that I insert 1 as minimum and 10 as maximum, I want value in cell AB1 to changed as 1 and print 2 copies, then 2..,then 3, and so on until 10 which will be printed also, then save and exit.
Here is what I have so far.

Code:
Private Sub PrintBtn_Click()


End Sub


Private Sub UserForm1_Activate()
TextBox1.SetFocus
End Sub

Private Sub StergeBtn_Click()
Unload Me
UserForm1.Show
End Sub

Private Sub TextBox1_Change()
     Sheets("Tiparire Facturi-Chitante").Range("AC1") = TextBox1.Value
     End Sub
    
    
Private Sub TextBox2_Change()
    Sheets("Tiparire Facturi-Chitante").Range("AC2") = TextBox2.Value
End Sub
Is not to much, but i`m struggling.

Thanks for your help.
 
Last edited:

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
.
Your description and question are confusing. However, and hopefully, this example will help :

Code:
Option Explicit


Sub PrintOut_Method_All_Parameters_Listed()
'List of all of the optional parameters for printing an Excel spreadsheet using the PrintOut method


Worksheets.PrintOut _
From:=Range("F8"), _
To:=Range("F9"), _
Copies:=Range("F10"), _
Preview:=False, _
ActivePrinter:="", _
PrintToFile:=False, _
Collate:=True, _
PrToFileName:="", _
IgnorePrintAreas:=False


End Sub

Download workbook : https://www.amazon.com/clouddrive/share/Cc9xe7nWrV5iX6wFF3xKoK8WBnQf185hce0g7nEh8Pz
 
Upvote 0
Thank you for your reply.
Directly on your example I will explain what I want to achieve.
Each number inserted between Range F8 and Range F9 will aquire the information from another sheet, and update the sheet I want to print. So I need each number between Range F8 and Range F9 to update the printing sheet and print it accordingly afterwards. For Example: I will insert in Range F8 number 10 and in Range F9 number 13.
Vba code should take number 10 and insert into Range AC1 the sheet that needs to be printed, according to number 10) and then print 2 copies. Then number 11 will be inserted in Range AC1, update the sheet that needs to be printed according to number 11, and print 2 copies. Same with no 12 and 13.
I hope I made myself a bit more clear, and thanks again for your help.
 
Upvote 0
Vba code should take number 10 and insert into Range AC1 the sheet that needs to be printed, according to number 10)

From your description, all that is being accomplished is taking the current sheet being printed and placing that number in AC1. Is there a reason why you would want to display which sheet is presently
being printed ? Is it necessary to display which sheet is being printed ?

If there is another reason for displaying the currently printing sheet in AC1 please explain.

Of ... have I completely misunderstood your description ? If so, please explain further.
 
Last edited:
Upvote 0
So, I have an invoice file with two sheets. In sheet 1 I have client information and in sheet 2 the invoice. The number inserted in sheet 2 range AC1, will update the invoice accordingly, matching with client info (AC1) from sheet 1. This is why I have to update the sheet each time, before printing it.
I hope I make my self clear, if not I will try to attach the file.
 
Upvote 0
.
Best to post your file to DROPBOX.COM or similar website so we can view your code.

Post the link to the file download here.
 
Upvote 0
Hi,

Please see LINK

In "Sheet 1" I will insert the clients I want to send invoices to.
When I insert numbers in the yellow cell named "position" within sheet "INVOICE", the invoice will be updated according to the corresponding client from "Sheet 1".
After I click "print" on the macro button, in the window that opens, I will set an interval (example: 1-5), I want to have invoices from 1 to 5 printed automatically, and after this, I want the table in "Sheet 2" to be filled in with the printed invoices (1-5).
I also need to have some extra features, such as :
1. Automatically saving the invoices and also the table in "Sheet 2" as .pdf file;
2. The .pdf files should be saved into a folder named according to the current year, and within this folder, a secondary folder named according to row "V" from Sheet 1, and "First invoice number to be printed" from Userform 1.
Thank you.
 
Upvote 0

Forum statistics

Threads
1,214,613
Messages
6,120,515
Members
448,968
Latest member
Ajax40

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