Thread: Function or VBA
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
iliace iliace is offline
external usenet poster
 
Posts: 229
Default Function or VBA

Following assumptions:
* You are running a single instance of Excel (usually this is the
case)
* Your Quotations workbook is in a file called Quotations.xls
* You want the Active Sheet to be copied after the first worksheet in
Quotations.xls

The following sub, when assigned to your command button, will copy the
active sheet (on which the button is located, presumably) will be
copied. If Quotations.xls is not open, an error message is displayed.

Private Sub Button1_Click()
Dim wsh As Excel.Worksheet

Set wsh = Application.ActiveSheet

On Error Resume Next
wsh.Copy
After:=Application.Workbooks("Quotations.xls").Wor ksheets(1)
If Err.Number < 0 Then
Call MsgBox("Error copying worksheet")
End If
On Error Goto 0
End Sub


On Dec 3, 2:42 pm, AFJr wrote:
Hi,

Our company has a "Contract Review" form made up of 5 sheets. There are
certain situations when we will want 2 of the sheets to be included in our
quotation package to the customer. These 2 sheets contain the specifications
the RFQ was generated to.

My thought is to put a button on the individual sheets in the Contract
Review form. This will enable the estimator to click the button and insert
the sheets into the "Quotation" form.

Will this be easier to do via FUNCTIONS or VBA?

I am currently taking myself through Excel Programming Weekend Crash Cousre.
My experience with programming VBA is novice at best. I've written programs
for PLC's using ladder logic and also statement list. Just wondering, the
learning curve for VBA seems like it might be a while before I can accomplish
what I want to do with this.

--
TIA

AFJr