PDA

View Full Version : VBA Command to Find Invoices designated as NotPrinted and place invoice number into c



Mcarrigg
04-23-2012, 04:13 PM
Hi All,

I have a project that i am working on and i am stuck on an issue.

I have a workbook which has three worksheets.

"Details" - Contains invoice information in rows...each invoice number may have multiple rows depending on items invoiced
"Invoice" - Invoice template gets populated by entering invoice number from "Details" sheet column A
"Customers" - Contains Customer information.

I have got a module macro function in my main workbook that copies the invoice template to its own workbook, saves a pdf and emails each invoice once a command button beside the invoice is pressed and this works fine.

Basically my problem is that I want to click a command button that when clicked, searches column Q of "Details" worksheet and finds each instance of ïnvoices that are un printed ("not printed").

Once the command finds a not printed value, it grabs the invoice number from column A of the "Details" sheet and places this invoice number into cell H11 of the "Invoice" worksheet template.

My formulas in the invoice template worksheet will automatically update the invoice based on invoice number.

Once this is done I want it to launch my macro to copy print and email pdf (Called CopySend() Macro located in Module1). Once this process is completed it changes the invoice status to "Printed" and then goes on to search for the next instance of "not printed" and repeat the process.

Please see attached sample workbook for structure (formulas are not working in this one but work in my main file)

I am new to VBA and struggling to get my head around a VBA solution.

Thanks for your help on this one!

p45cal
04-23-2012, 04:29 PM
for info: cross post
http://www.mrexcel.com/forum/showthread.php?p=3128859

Mcarrigg
04-23-2012, 05:42 PM
Hi p45cal,

I have used a couple of forums to search for hints on how to do things so I thought I would post across these forums to see if I can get a result.

Sorry if this has caused a problem

Tinbendr
04-24-2012, 06:46 AM
I have used a couple of forums to search for hints on how to do things so I thought I would post across these forums to see if I can get a result.

Sorry if this has caused a problemCross posting is considered rude unless the link is provided.

Added formula to Invoice!H11.
Added Command button and code at Details!Q1

If I understand your description, the rest of your code should handle the rest.

BrianMH
04-24-2012, 07:02 AM
I know you already have your workbook solution. Can I make a suggestion that you use Access for this sort of thing? The kind of data you have there is exactly what a database is made for and they are less apt to be corrupted if it is ever used as a shared resource.

Sorry if you aren't interested but looking at the way your data is and that certain parts of it require multiple rows just screams "use access" at me.