how to link macros do run all together..

sachi1982

New Member
Joined
May 14, 2015
Messages
30
Office Version
  1. 365
Platform
  1. Windows
Hi All,

i need to link 3 of my macros together, so that it will run completely. how would i do that. below are the end and the beginning of the macros. thanks,

Code:
Range("A2").Select
ActiveCell.FormulaR1C1 = "=RC[1]&""/""&RC[2]"
Range("A2").AutoFill Destination:=Range("A2:A" & Cells(Rows.Count, "B").End(xlUp).Row)
Range("A2").Select
Selection.Copy
Sheets("Peak Cancellation Charges").Select
Range("A2").Select
ActiveSheet.Paste
Range("A2").AutoFill Destination:=Range("A2:A" & Cells(Rows.Count, "B").End(xlUp).Row)
Range("a65536").End(xlUp).Select
Selection.EntireRow.Delete
End Sub
Sub ContractUpdate2()
'
' ContractUpdate2 Macro
' Spacing
'
' Keyboard Shortcut: Ctrl+w
'
Sheets("Hotel Name Changes_1").Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
.
.
.

And this code goes on and ends with
.
.
.

Sheets("Peak Cancellation Charges").Select
Selection.End(xlUp).Select
Selection.End(xlUp).Select
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
ActiveWorkbook.Worksheets("Peak Cancellation Charges").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Peak Cancellation Charges").Sort.SortFields.Add Key _
:=Range("A1"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
xlSortNormal
With ActiveWorkbook.Worksheets("Peak Cancellation Charges").Sort
.SetRange Range("A2:BB70000")
.Header = xlNo
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With

End Sub
Sub ContractUpdate3()
'
' ContractUpdate3 Macro
' replace -1 to no show and use deleting for insert and Delete
'
' Keyboard Shortcut: Ctrl+e
'
Sheets("Cancellations_4").Select
Selection.AutoFilter
Range("E11").Select
Cells.Replace What:="-1", Replacement:="no show", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
ActiveSheet.Range("$A$1:$BB70000").AutoFilter Field:=5, Criteria1:="INSERT"
Range("S2").Select
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Create another macro and use the word Call and the macro names, so example below:

Sub CallMyMacros()
Call macro1
Call macro2
Call macro3
End Sub
 
Upvote 0
sorry does not seem to work. i am getting a error message "sub or function not defined".
 
Upvote 0
Did you change the names of the calls to those of your macros ???
Code:
Sub CallMyMacros()
Call macro1  '...whatever this one is called
Call ContractUpdate2
Call ContractUpdate3
End Sub
 
Upvote 0
just put the CallMyMacros() sub in a Standard Module
Where do you have the Subs to be called, are they also in a Standard module ???
 
Upvote 0

Forum statistics

Threads
1,214,614
Messages
6,120,517
Members
448,968
Latest member
Ajax40

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top