Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default variable in excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default variable in excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default variable in excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default variable in excel

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default variable in excel

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Runtime Error '91' Object variable or With block variable not set Alec Coliver Excel Discussion (Misc queries) 2 October 24th 09 02:29 PM
How to graph x-variable versus y-variable in Excel ? Mojjara New Users to Excel 3 April 2nd 09 05:38 PM
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? Daniel Excel Worksheet Functions 1 July 9th 05 03:05 AM
setting a range variable equal to the value of a string variable Pilgrim Excel Programming 2 July 1st 04 11:32 PM
Cells.Find error Object variable or With block variable not set Peter[_21_] Excel Programming 2 May 8th 04 02:15 PM


All times are GMT +1. The time now is 11:59 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"