ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Run macros macro (https://www.excelbanter.com/excel-discussion-misc-queries/132049-run-macros-macro.html)

blazzzercat via OfficeKB.com

Run macros macro
 
I recorded the following macro to run three other macros. The code references
a particular workbook name. How do I change that so it will run in any
workbook

Thanks so much.

Sub CBRunMacros()
'
' CBRunMacros Macro
'

'
Application.CutCopyMode = False
Application.Run "'DFC MUSA AR Credit Balances 013107.xls'!CBcellformat"
Application.Run _
"'DFC MUSA AR Credit Balances 013107.xls'!mcrInsertTwoRowsOnEmpty"
Application.Run "'DFC MUSA AR Credit Balances 013107.xls'!CBSubtotal"
Columns("F:F").EntireColumn.AutoFit
Columns("G:G").EntireColumn.AutoFit
Columns("I:I").EntireColumn.AutoFit
Columns("J:J").EntireColumn.AutoFit
End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200702/1


chad

Run macros macro
 
try just taking out the workbook reference, i.e.
Application.Run "CBcellformat"

Hope this helps,
-Chad

"blazzzercat via OfficeKB.com" wrote:

I recorded the following macro to run three other macros. The code references
a particular workbook name. How do I change that so it will run in any
workbook

Thanks so much.

Sub CBRunMacros()
'
' CBRunMacros Macro
'

'
Application.CutCopyMode = False
Application.Run "'DFC MUSA AR Credit Balances 013107.xls'!CBcellformat"
Application.Run _
"'DFC MUSA AR Credit Balances 013107.xls'!mcrInsertTwoRowsOnEmpty"
Application.Run "'DFC MUSA AR Credit Balances 013107.xls'!CBSubtotal"
Columns("F:F").EntireColumn.AutoFit
Columns("G:G").EntireColumn.AutoFit
Columns("I:I").EntireColumn.AutoFit
Columns("J:J").EntireColumn.AutoFit
End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200702/1



Don Guillett

Run macros macro
 

IF?? the macro is in the workbook try

CBRunMacros Macro()

CBcellformat
mcrInsertTwoRowsOnEmpty
CBSubtotal

range("f1,g1,i1,j1").EntireColumn.AutoFit
End Sub


--
Don Guillett
SalesAid Software

"blazzzercat via OfficeKB.com" <u30352@uwe wrote in message
news:6e3e5a56b393e@uwe...
I recorded the following macro to run three other macros. The code
references
a particular workbook name. How do I change that so it will run in any
workbook

Thanks so much.

Sub CBRunMacros()
'
' CBRunMacros Macro
'

'
Application.CutCopyMode = False
Application.Run "'DFC MUSA AR Credit Balances 013107.xls'!CBcellformat"
Application.Run _
"'DFC MUSA AR Credit Balances 013107.xls'!mcrInsertTwoRowsOnEmpty"
Application.Run "'DFC MUSA AR Credit Balances 013107.xls'!CBSubtotal"
Columns("F:F").EntireColumn.AutoFit
Columns("G:G").EntireColumn.AutoFit
Columns("I:I").EntireColumn.AutoFit
Columns("J:J").EntireColumn.AutoFit
End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200702/1




blazzzercat via OfficeKB.com

Run macros macro
 
Works great thanks!

Chad wrote:
try just taking out the workbook reference, i.e.
Application.Run "CBcellformat"

Hope this helps,
-Chad

I recorded the following macro to run three other macros. The code references
a particular workbook name. How do I change that so it will run in any

[quoted text clipped - 18 lines]
Columns("J:J").EntireColumn.AutoFit
End Sub


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...excel/200702/1



All times are GMT +1. The time now is 07:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com