Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have little problem with my macro. How to assign the value of the
variable to other macro which I call in main macro. Sub Macro1() sheet_name = "Measurement 1" Call Looping Call Positifing End Sub I have "sheet_name" variable inside the Looping and Positifing macros .. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
you need to declare the variable at the top of the module sheet Dim sheet_name as String if all of the code is in the same module sheet. If it isn't you need to declare the variable as Public sheet_name as String at the top of a module sheet Hope this helps Cheers JulieD "anang" wrote in message om... I have little problem with my macro. How to assign the value of the variable to other macro which I call in main macro. Sub Macro1() sheet_name = "Measurement 1" Call Looping Call Positifing End Sub I have "sheet_name" variable inside the Looping and Positifing macros . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Here is another way. You can pass the variable as an argument as follows. Sub Macro1() Dim sheet_name As String sheet_name = "Measurement 1" Call Looping(sheet_name) Call Positifing(sheet_name) End Sub Sub Looping(ByVal Sh_Name) MsgBox Sh_Name End Sub Sub Positifing(ByVal Sh_Name) MsgBox Sh_Name End Sub Regards, Colo "anang" wrote in message om... I have little problem with my macro. How to assign the value of the variable to other macro which I call in main macro. Sub Macro1() sheet_name = "Measurement 1" Call Looping Call Positifing End Sub I have "sheet_name" variable inside the Looping and Positifing macros . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
declare the variable public outside the main routine
Public sheet_name as String Sub Macro1() sheet_name = "Measurement 1" Call Looping Call Positifing End Sub -- If I've mis-understood the question please tell me. HTH ijb Remove nospam from my e-mail address to talk direct Not MCSD, MVP, TLA, P&P, PCMCIA, etc just trying to help "anang" wrote in message om... I have little problem with my macro. How to assign the value of the variable to other macro which I call in main macro. Sub Macro1() sheet_name = "Measurement 1" Call Looping Call Positifing End Sub I have "sheet_name" variable inside the Looping and Positifing macros . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
declare the variable public outside the main routine
Public sheet_name as String Sub Macro1() sheet_name = "Measurement 1" Call Looping Call Positifing End Sub -- If I've mis-understood the question please tell me. HTH ijb Remove nospam from my e-mail address to talk direct Not MCSD, MVP, TLA, P&P, PCMCIA, etc just trying to help "anang" wrote in message om... I have little problem with my macro. How to assign the value of the variable to other macro which I call in main macro. Sub Macro1() sheet_name = "Measurement 1" Call Looping Call Positifing End Sub I have "sheet_name" variable inside the Looping and Positifing macros . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Runtime Error '91' Object variable or With block variable not set | Excel Discussion (Misc queries) | |||
How to graph x-variable versus y-variable in Excel ? | New Users to Excel | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions | |||
setting a range variable equal to the value of a string variable | Excel Programming | |||
Cells.Find error Object variable or With block variable not set | Excel Programming |