Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have created the following private sub in my worksheet:
Private Sub CommandButton1_Click() ' Define a área de impressão ActiveSheet.PivotTables("Pivot Table Show Price").PivotSelect _ "Produto[All]", xlLabelOnly, True ActiveSheet.PageSetup.PrintArea = _ ActiveCell.CurrentRegion.Address Range("A1").Select End Sub So, now I want to create a macro to do perform some actions (see below) and to run this private sub as the last action of the macro below...how can I do this? Sub Copy_Log() Application.Goto Reference:="Log" Selection.Copy Workbooks.Open Filename:="S:\Finance\Pricing\General\TimeTable1.x ls" Sheets("DB").Select Application.Goto Reference:="Index1" Selection.End(xlDown).Select ActiveCell.Offset(1, 0).Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=True Range("A1").Select Application.CutCopyMode = False ActiveWorkbook.Save ActiveWindow.Close End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Are the two procedures in the same module, class or sheet. If not then you
can not reference the private sub from the other. That is the purpose of private. If they are both in the same module then you can reference it by adding it in. Since this is an event procedure take to code out of the private sub and put it in a public sub. Reference the public sub from both the on click and the other sub... HTH... "Flima" wrote: I have created the following private sub in my worksheet: Private Sub CommandButton1_Click() ' Define a área de impressão ActiveSheet.PivotTables("Pivot Table Show Price").PivotSelect _ "Produto[All]", xlLabelOnly, True ActiveSheet.PageSetup.PrintArea = _ ActiveCell.CurrentRegion.Address Range("A1").Select End Sub So, now I want to create a macro to do perform some actions (see below) and to run this private sub as the last action of the macro below...how can I do this? Sub Copy_Log() Application.Goto Reference:="Log" Selection.Copy Workbooks.Open Filename:="S:\Finance\Pricing\General\TimeTable1.x ls" Sheets("DB").Select Application.Goto Reference:="Index1" Selection.End(xlDown).Select ActiveCell.Offset(1, 0).Range("A1").Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=True Range("A1").Select Application.CutCopyMode = False ActiveWorkbook.Save ActiveWindow.Close End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Combining two Subs | Excel Discussion (Misc queries) | |||
Stringing Subs | Excel Programming | |||
calling subs | Excel Programming | |||
Recursive Subs? | Excel Programming | |||
calling private subs | Excel Programming |