Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Use a variabel

Alvin,

Be that as it may, it won't work in a worksheet function.

As I suggested, best to save it to a worksheet/ So where you have omroeder =
omroeder.value , use
Worksheets("Sheet1").Range("IV1").Value = onroeder.value

and in your worksheet use

INDIRECT.EXT("'c:\city breaks\priser\usa\"& Sheet1!$IV$1
&"\["&beregn!$B$1&".xls]prisliste'!$b$1"))



--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alvin Hansen" wrote in message
...
Wll
in my form i have
omroeder = omroeder.value ( omroeder.value is from a combobox)

My variabel omroeder i use in a module with
GetData "c:\city breaks\priser\usa\" & omroeder & "\byer.xls", "byer",
"A1:C200", Sheets("byer").Range("A1"), True

and here my variabel "omroeder" works

Alvin

"Bob Phillips" skrev:

If you mean that
INDIRECT.EXT("'c:\city breaks\priser\usa\"& omroeder
&"\["&beregn!$B$1&".xls]prisliste'!$b$1"))
is a worksheet function, you are way off track here. You cannot access a

VBA
variable directly from a worksheetfunction , you would need to use a UDF

and
call that to get the value, but of course, your true will have ended by

then
so the variable is likely to be empty unless you declare it static.

Your best way will be to use a worksheet cell and save the value in

there
and add that in the worksheetfunction (or use a workbook name).

BTW, how does omroeder = omroeder.Value work, it is not making sense to

me?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alvin Hansen" wrote in message
...
Ok i try to explain

In my form i have
omroeder = omroeder.Value
in a module i have
Public omroeder

In a shette i have:
INDIRECT.EXT("'c:\city breaks\priser\usa\"& omroeder
&"\["&beregn!$B$1&".xls]prisliste'!$b$1"))

and here i get an error it can't find this file

Alvin


"Bob Phillips" skrev:

If you have declared it as public variable in a module, it should be
accessible anywhere, including a sheet.

What does not working mean exactly, an error or a wrong value? Where

did
you
store the variable?

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Alvin Hansen" wrote in

message
...
Hi
Thanks its working now
but i also use this variabel in a sheet
here it dosn't work ?

Alvin


" skrev:

Either pass it to the function in the module:

ModuleFunc(variable1)


or dont "dim" this in your form but rather dim it as
public in a module - and you can then access this variable
anywhere. However "global" variables of this type are
generally considered bad form and can lead to messy code
that is hard to debug. Generally you want to scope your
variables as tightly as possible.


-----Original Message-----
Hi!!

A variabel named in a form (general)
how and can I use this variabel in a macro (module)

Best regards alvin

.










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
countif with variabel criteria? Hans Excel Worksheet Functions 2 January 23rd 08 06:57 AM
getting the sum of variabel ranges Hein Excel Worksheet Functions 4 March 26th 06 07:44 PM
Use variabel as reference Andres Angel[_2_] Excel Programming 2 October 4th 04 10:39 PM
Variabel and caption in userform Alvin Hansen[_2_] Excel Programming 0 September 21st 04 07:45 PM
Using a variabel to make an array? SkatKat Excel Programming 4 May 24th 04 02:08 PM


All times are GMT +1. The time now is 03:53 AM.

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"