ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ActiveWorkbook pointer for Macros from PERSONAL.XLS (https://www.excelbanter.com/excel-programming/334796-activeworkbook-pointer-macros-personal-xls.html)

Robert

ActiveWorkbook pointer for Macros from PERSONAL.XLS
 
I am now trying to run all macros FROM Personal.xls. Having followed some of
the posts, I tried but I am still unable to point to the worksheet that has
to be run.
Seek help (Norman Jones? Ron de Bruin?) Thank you.
Examples of my macros:
Macro1
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate
Application.Run "PERSONAL.XLS!Sort1"
Application.Run "PERSONAL.XLS!Sort2"
Range("G2").Select
Calculate
End Sub
====
Macro Sort1 (only the beginning quoted here)

Application.Goto Reference:="STARTSORT1"
Range("J1:J2000").Select
Selection.Copy
Application.Goto Reference:="R11001C11"
............End Sub
=====
MacroSort2 (only beginning quoted here)

Dim i As Long
Application.Goto Reference:="STARTSORT2"
Range("A1:IR2000").Copy
Range("A11000").PasteSpecial Paste:=xlPasteValues, _
.......End Sub

Norman Jones

ActiveWorkbook pointer for Macros from PERSONAL.XLS
 
Hi Robert,

I am now trying to run all macros FROM Personal.xls. Having followed some
of
the posts, I tried but I am still unable to point to the worksheet that
has
to be run.


One way :

Add an argument (ShtName) to the sort1 routine in Personal.xls:

Sub Sort1(ShtName As String)
Dim sh As Worksheet

Set sh = ActiveWorkbook.Sheets(shtName)

' Your procesing code

End Sub

You can then pass the name of the requisite sheet to the Sort1 routine from
the call statement, e.g.:

Sub Macro1()

'Do something
Application.Run "Personal.xls!Sort1", "MySheet"
'Do something elae

End Sub


---
Regards,
Norman


"Robert" wrote in message
...
I am now trying to run all macros FROM Personal.xls. Having followed some
of
the posts, I tried but I am still unable to point to the worksheet that
has
to be run.
Seek help (Norman Jones? Ron de Bruin?) Thank you.
Examples of my macros:
Macro1
Application.MaxChange = 0.001
ActiveWorkbook.PrecisionAsDisplayed = False
Calculate
Application.Run "PERSONAL.XLS!Sort1"
Application.Run "PERSONAL.XLS!Sort2"
Range("G2").Select
Calculate
End Sub
====
Macro Sort1 (only the beginning quoted here)

Application.Goto Reference:="STARTSORT1"
Range("J1:J2000").Select
Selection.Copy
Application.Goto Reference:="R11001C11"
...........End Sub
=====
MacroSort2 (only beginning quoted here)

Dim i As Long
Application.Goto Reference:="STARTSORT2"
Range("A1:IR2000").Copy
Range("A11000").PasteSpecial Paste:=xlPasteValues, _
......End Sub




Norman Jones

ActiveWorkbook pointer for Macros from PERSONAL.XLS
 
Hi robert,

You can then pass the name of the requisite sheet to the Sort1 routine
from the call statement, e.g.:


Should read:

You can then pass the name of the requisite sheet to the Sort1 routine from
the Run statement, e.g.:

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Robert,

I am now trying to run all macros FROM Personal.xls. Having followed some
of
the posts, I tried but I am still unable to point to the worksheet that
has
to be run.


One way :

Add an argument (ShtName) to the sort1 routine in Personal.xls:

Sub Sort1(ShtName As String)
Dim sh As Worksheet

Set sh = ActiveWorkbook.Sheets(shtName)

' Your procesing code

End Sub

You can then pass the name of the requisite sheet to the Sort1 routine
from the call statement, e.g.:

Sub Macro1()

'Do something
Application.Run "Personal.xls!Sort1", "MySheet"
'Do something elae

End Sub


---
Regards,
Norman




Robert

ActiveWorkbook pointer for Macros from PERSONAL.XLS
 
Thank you Norman. I am a novice, have tried the whole morning to put in your
suggestion but I just cannot get it. Now looking up for similar examples.
When I
do get it right, I shall let you know.
--
Robert


"Norman Jones" wrote:

Hi robert,

You can then pass the name of the requisite sheet to the Sort1 routine
from the call statement, e.g.:


Should read:

You can then pass the name of the requisite sheet to the Sort1 routine from
the Run statement, e.g.:

---
Regards,
Norman



"Norman Jones" wrote in message
...
Hi Robert,

I am now trying to run all macros FROM Personal.xls. Having followed some
of
the posts, I tried but I am still unable to point to the worksheet that
has
to be run.


One way :

Add an argument (ShtName) to the sort1 routine in Personal.xls:

Sub Sort1(ShtName As String)
Dim sh As Worksheet

Set sh = ActiveWorkbook.Sheets(shtName)

' Your procesing code

End Sub

You can then pass the name of the requisite sheet to the Sort1 routine
from the call statement, e.g.:

Sub Macro1()

'Do something
Application.Run "Personal.xls!Sort1", "MySheet"
'Do something elae

End Sub


---
Regards,
Norman






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

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