use input box variable in more than one module / procedure

Shadow123

Board Regular
Joined
Aug 20, 2012
Messages
124
Ok i know i have done this before but im totally blanking. I want to user the inputvalue in procedures called from controller, but it just shows as empty.

What am i doing wrong?

Code:
Sub controler()
Static inputvalue As Long
inputvalue = InputBox("Please set min size of trades.")
'other macro's called here
end sub
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
i need to use this result in about 10 macros in lots of modules... im just calling them by putting

call mynextmacro

and so on
 
Upvote 0
I just need an input box to pop up ... and keep that value.

I tried
Code:
Option Explicit
Public inputvalue As Long


Public Sub controler()
inputvalue = InputBox("Please set min size of trades.")

call macro1
end sub
but once i get into macro1, the variable is gone... im not sure what im doing wrong. do i need Sub macro1(inputvalue) ? or is sub macro1 enough
 
Upvote 0
Even this, as a test doesn't work

Code:
Public inputvalue As Long
Sub testing()
inputvalue = InputBox("Please enter value")
Debug.Print inputvalue
Call messageformat
End Sub
 
Sub messageformat()
MsgBox (inputvaluve)
End Sub


The debug print result was
100

Its available until it calls the next procedure then poof... gone
 
Upvote 0

Forum statistics

Threads
1,203,242
Messages
6,054,353
Members
444,718
Latest member
r0nster

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