![]() |
Button to generate report
Hi, I'm very new to VBA. I have a worksheet with 5 fields (a1-a2-a3-a4-a5). I
want to create a button that will generate a new file to make some sort of invoice with the name in cell a1 and the numbers in cells a2-a3-a4-a5. How can I do this? Thanks. |
Button to generate report
The following macro takes the values in A1:A5 of the active sheet and copies
them to A1:A5 of the InventorySheet. Place a Forms button (View - Toolbars - Forms, click on the button icon and draw the button where you want it) and assign this macro to that button. Sub GenerateInvoice() With Sheets("InventorySheet") Range("A1:A5").Copy .Range("A1") End With End Sub Note that there is a space after the word "Copy". Place his macro in a normal module. HTH Otto "juniorc" wrote in message ... Hi, I'm very new to VBA. I have a worksheet with 5 fields (a1-a2-a3-a4-a5). I want to create a button that will generate a new file to make some sort of invoice with the name in cell a1 and the numbers in cells a2-a3-a4-a5. How can I do this? Thanks. |
Button to generate report
Hi, begin recording a macro that does what you are trying to do. Then
add a command button and right click it change the name and caption properties to your suite your needs. Double click on the button (in design view) and the code window will pop up with similar code: Sub CommandButton1_Click() 'Enter the following line Call 'your macro name here' End Sub Hopefully, this gives you a place to start--Lonnie M. |
All times are GMT +1. The time now is 12:28 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com