can i use one workbook to perform instructions i another

D

des-sa

i was helped by so many people over the last few weeks that i created an
excellent solution to what was a huge problem in our company. now i would
want to hear if my next step is possible. what i did is to create a
quotation in a workbook that automatically number each new one consecutively
with a unique number and a lot more very useful functions you guys helped me
with. so the quote was given to the customer, now he accepts it. what i
would now like to do is to, from the original quote, to instruct the job card
(a new/other work book) to open, give the job card the same number and
entries in the quote. my questions:
1. how do i instruct, from say workbook "quote1487" a new workbook, by the
name of "jobcard1487" to open
2. how do i duplicate 5 or 6 ranges of cells in "quote1487" in the new
workbook "jobcard1487".
thank you
 
B

Bernie Deitrick

A lot depends on your naming convention (are there always 4 digits?) and which range you want to
copy (and whether you want to copy and paste values, or formats, or formulas...) but this is the
general approach, with the code in quote1487

Dim myB As Workbook
Set myB = Workbooks.Add
myB.SaveAs Thisworkbook.Path & "\jobcard" & Right(Thisworkbook.Name, 8)
Thisworkbook.Worksheets("Sheet1").RAnge("A1:A6").Copy _
myB.Worksheets(1).Range("A1:A6")
myB.Save

HTH,
Bernie
MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top