How to pass variable to a Sub

Hi,

Private Sub Worksheet_activate()
Dim X
X = Sheets("DATA").UsedRange.Rows.Count
Application.Run "WhatEver"
End Sub

I would like to pass the value of X to WhatEver Sub.

How can I do that?

Thanks,


Alai

--
Message posted from http://www.ExcelForum.com

0
4/28/2004 9:51:11 AM
excel.misc 78881 articles. 5 followers. Follow

2 Replies
290 Views

Similar Articles

[PageSpeed] 30

Alain,

You can pass variables directly in the Run method. E.g.,

Application.Run "WhatEver", X


-- 
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"alainB >" <<alainB.15f339@excelforum-nospam.com> wrote in
message news:alainB.15f339@excelforum-nospam.com...
> Hi,
>
> Private Sub Worksheet_activate()
> Dim X
> X = Sheets("DATA").UsedRange.Rows.Count
> Application.Run "WhatEver"
> End Sub
>
> I would like to pass the value of X to WhatEver Sub.
>
> How can I do that?
>
> Thanks,
>
>
> Alain
>
>
> ---
> Message posted from http://www.ExcelForum.com/
>


0
chip1 (1821)
4/28/2004 10:42:54 AM
Thanks Chip!

Alai

--
Message posted from http://www.ExcelForum.com

0
4/28/2004 11:05:38 AM
Reply:

Similar Artilces:

Is It Possible To Pass Parameters to A Pass Through Query
My assumption is that's it's not. At work I use ODBC to connect to our oracle database with Access 2003. There are cases where using a pass through query runs much much faster and I then use it in a make table query to make a local table. In access you can use brackets [] to have it ask for input. May I assume there is no way to do anything like that in a pass through query? Create a PassThrough query and use code to assign the SQL to this query filtering it with a parameter, and then run it e.g Dim MyVariable As Integer MyVariable = InputBox("Please select a Number&quo...

Pass multiple selected values from list box to table
How do I pass multiple selected values from a list box to a table? I've found code to use the values as criteria in a query but would now like to store the values in a table (at least temporarily) thanks in advance. jack Pass selected values from a list box to a table? I don't really think you want to do this. Can you describe more about what you are trying to accomplish? You just store raw data in a table. You don't store manipulated data in a table. Maybe you need a query to do what you want to do... -- Ryan--- If this information was helpful, please indi...

How to pass an object from C++
Hello! We have a C# asp.net web application that is using a COM dll We use the tlbimp to be able to use the COM dll from C# asp.net web application The method InitRules shown below is located in the COM dll. It can be seen below the text Original. Method InitRules below is called from C# but we want to pass an object of type Handle_DS in addition to all the other parameters. You can see the modified InitRules below marked Modified Note the object of type Handle_DS is a C++ object that is created from C# asp.net application and pass into the InitRules I have also copied the whole idl fil...

Pole display Sub Total
Hi All, When a client of mine scans items the amount displaying is the sub total. Is there any way to display the total (ie including tax amount) Regards Amanda ...

100% Passing Guaranteed in All I.T. Exams/Certifications at 1st Attempt Hi Friends, To pass all types of I.T Exams/Certifications with mind blowing results in 1st attempt just visit http://www.itreal
100% Passing Guaranteed in All I.T. Exams/Certifications at 1st Attempt Hi Friends, To pass all types of I.T Exams/Certifications with mind blowing results in 1st attempt just visit http://www.itrealexams.com/ and get real time Q&As, Brain Dumps, Real Exams, Study material, E-Books, Video Exams and Labs for your all type of I.T Certification Exams. ...

Can You Use SQL Max() Function Based on Variable From Form
Hello, I'm wondering if it is possible to execute a SQL query at runtime, from a Form, and to alter the query programmatically based on a value (variable) passed from the Form to the query. I am looking to obtain a max value of a number based that is related to the variable that will (hopefully) be passed from the Form to the query at runtime. Thanks, Cindy -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-formscoding/200711/1 There are a number of ways this can be accomplished using VBA. One is to build the query programmatically. Another i...

Passing arguments to procedures
There is something fundamental that I have failed to grasp about passing arguments to procedures. I have a form featuring a set of unbound controls displaying dates and the corresponding days of the week. (For some reason, the long-date format, on my computer, does not include the latter, as the documentation suggests it might, so it has to be separately calculated and displayed.) A default date is displayed in each control, on Form_Open. This can then be manually adjusted by a pair of ‘up’ and ‘down’ buttons associated with each day/date control pair. In the case of the control ‘St...

sub query
Does MS Access support sub query? I wanted to create a query which has sub query like following Select MyField, (select MyField1 from mytable1 where mytable1.myfiled2 = mytable.MyField3) from mytable Do I need create 2 queries to do this or just one query with one sub query? Your information is great appreciated, Yes. Access supports subqueries like that. More info and some examples: http://allenbrowne.com/subquery-01.html -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at ...

Thread and variable scope
Hi, I am facing a very weird problem, I know that the solution is easy but I cannot find it by myself. I create a thread from a class method and before to create it I display the adress pointer of a variable encapsulated in my class like that : int CBioWrapper::ARSSensorRecording(IN TARSSensorPicture APicture,IN TARSSensorSample ASample,IN int ASampleNumber, IN THANDLE AContext) { DWORD dwThreadId = 0; m_pstSample = &ASample; m_csTmp.Format(L"1 :pstSample->Data 0x%x",m_pstSample->Data ); AfxMessageBox(m_csTmp); //HERE IT DISPLAYS 0x52b20 m_hRecordThr...

static member variable not working with static member functions
Hello, think its a lack of knowledge, but I have problem to realize the following szenario: I have a class C. I have 2 member function F1 and F2. F1 is static F2 not. I would like to access a static private member variable V1 from F1 and F2, so in principle both are working on the same memory-physical variable. I don't get it work. What is the right way to realize this? Best Regards Something else must be at work here. Both F1 and F2 should be able to access the static member variable. "ZZT" <a@b.c> wrote in message news:c14s48$66b$1@news1.wdf.sap-ag.de... > H...

IT CertificationzzzZ.....100% GUARANTEED PASS.......!!!@!!!
IT CertificationzzzZ.....100% GUARANTEED PASS.......!!!@!!! Hi guys, If you are serious about your professional career and pass IT Certification exam in first attempt then Visit http://www.FreeExamKing.com and get latest Questions And Answers Dumps for Microsoft, Oracle, Cisco, CompTIA and many more, i have used and found it very helpful. ...

formula containing a formula-dependent variable
I need a excel/office 2003 formula to work out =countif(G$3:G$nn,G3) where 'nn' is calculated by another formula in another cell: =M1+COUNTIF(B:B,B3). Seems like it should be easy but nothing I've tried works. None of the key words I've tried in Help have helped. Can someone point me in the right direction please. CompeterN (retired with no known office guru to help) have a look in the help index for INDIRECT or use a defined name range. -- Don Guillett SalesAid Software dguillett1@austin.rr.com "CompeterN" <CompeterN@discussions.microsoft.com> wrote in ...

Passing data between forms
Hi I am working on a project someone else started, and he has this code: If STR_FormName = "FMS_ToDo" Then Page47.SetFocus He obviously expects the name of the last form to be here, but it is not. In fact, when I put Option Explicit at the top - this field was undefined. How is this supposed to work? Stapes ...

Pass Parameter to stored procedure in pass thru query
How do I pass a parameter to a stored procedure in a pass thru query? I'd like to enter the parameter in a control on a form and then run the pass thru query and pass the parameter to it. I've tried this, but haven't been successful. Any ideas? Thanks. On Sun, 8 Jul 2007 18:04:26 -0500, "SAC" <sac@somewhere.com> wrote: >How do I pass a parameter to a stored procedure in a pass thru query? > >I'd like to enter the parameter in a control on a form and then run the pass >thru query and pass the parameter to it. > >I've tried this, b...

variable ranges
Hi I have Change event macro that sorts a table in G3:O6 when a value in F3:F6 is changed. What I need to happen is that if the range of the entered data is F13:F18 the table sorted changes to G13:O16. I have been trying to vary the values in the ‘If Not Intersect(Target, Range("F13:F18")) Then’ statemnt but without success. Any help would be appreciated. Al As ALWAYS, post your code for comments or If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgr...

You will pass all the exams at 1st attempt No more headaches and worry about spending the time and money to attempt another exam again. You will pass all of your exams, every time www.FreeExamKing.com
You will pass all the exams at 1st attempt No more headaches and worry about spending the time and money to attempt another exam again. You will pass all of your exams, every time www.FreeExamKing.com ...

how to have a method to return an uninitilized variable in c#?
Hi, We have byValue and ByReference in VB and out and ref parameters in C# 1- ref parameter expects an initialized variable 2- out should be initialized before return First Question: How can I have a parameter remain uninitialized after a return (that compiler expects to be initialized even after the invokation of the method)? (compiler designer might need to add a runtime error for reading from an uninitialized variable) Second Question: Somtimes compiler naggs about that not all code paths return a value? how can I assure the compiler it always return a value? Leon_Ami...

Setting Variables for SQL
Hi, Using Access 2000. I have a statement in a Union Query that is ([DEBT]![BAL]/[SALE]![TURNOVER])*7 AS [Calc DOC] which works albeit I want to round the result, I have added CINT but running the query now fails as says the query maybe to complex, try setting variables CANT(([DEBTMAIN]![CURRBAL]/[SALEMAIN]![TURNOVER])*7) AS [Calc DOC]. The CINT formula is shown 3 times in the SQL so a variable may work, albeit I can't find how to set this up. Any pointers would be helpful. Thanks Rob. Is the SALE!TURNOVER field ever Null or 0? -- Duane Hookom Microsoft Access MVP "Ro...

OnInitDialog and passing argument
Hello, I want to use a dialog for three different purpose so every time dialog should come up with a different situation. How can I pass argunment(s) to the OnInitDialog window message of the dialog ? Is it possible? Thanks Smith "JSmith" <jsmithmitra@yahoo.com> wrote in message news:u4ajmu$nEHA.3900@TK2MSFTNGP10.phx.gbl... > Hello, > > I want to use a dialog for three different purpose so every time dialog > should come up with a different situation. How can I pass argunment(s) to > the OnInitDialog window message of the dialog ? > Is it possible? The...

Linking a cell to another workbook cell based on a variable name
Hi all, Is there any way that I can link a cell in Workbook A to a cell in Workbook B(sheet1) based on a variable entry (workbook name) in Workbook A Workbook A contains two cells A1 = Workbook B (this is the variable name) B1 = I want this to be the same as cell B1 in Workbook B I will then want to copy the formula in Workbook A cell B1 to other cells so that B2, B3 etc.. will contain the data from the respective cells in Workbook B Hope the above makes sense Brian Workbook B will contain date in cell B1 = John Smith Brian wrote: > Hi all, > > Is there any way that I can ...

CAS 1000NP Variable Barcode Setup Problems...
I'm currently working with a CAS 1000NP Barcode Printing Scale and I can not get RMS 2.0 to scan. It Prints out 13 digit barcodes and they start with 0200000000000. The scan just brley displays the scan and I can see it is dropping off the 0. Any ideas? -- precisecheck you need to configure the scanner to read the correct barcode type. "PreciseCheck" wrote: > I'm currently working with a CAS 1000NP Barcode Printing Scale and I can not > get RMS 2.0 to scan. It Prints out 13 digit barcodes and they start with > 0200000000000. The scan just brley displays the ...

How to pass a parameter to a userform
Hi, I need to both open a useform and pass a parameter to it. How do I do this? I'd like to do the following but the Show method doesn't take this kind of parameter. Userform1.Show(param) Cheers Gromit -- Gromit ------------------------------------------------------------------------ Gromit's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=928 View this thread: http://www.excelforum.com/showthread.php?threadid=320229 Create a public variable in the userform, say called myVar, and then Load Userform1 Userform1.myVar = "SomeValue" ...

Two variables
I hope someone can help! I have a number of workbooks with various staff data including staff costs and proportion of time worked and cost centre by individual employee in one worksheet and need to do some analysis of this based on staff category in another sheets withinh the individual workbooks. I have proportion in column "N", category in "F" and cost centre in "M". Cost centres are in the format C********* and other cost centres start with either H or O The info has to be reported against staff category and cost centres (split between "C" an...

by passing SMTP
Hello, On my e-mail system here we use an external company called " postini " which filters our spam. We keep getting spam. My partner said its because it is comming in VIA smtp or other ways by passing postini. Is there a way to accept e-mail that comes only from the Postini IP Address? Please let me know ASAP. Thanks On your firewall, modify the rules to only allow SMTP connections from Postini. You can work with Postini to obtain a list of the IP's they send from. When using Postini, it's also a common practice to remove all MX records except those entries for...

Pass/Name not recognized
When I try to get my e-mail through outlook express, I enter my name an my password and both are correct because they work online but i outlook it keeps asking me for my Pass/Name. I currently have sb yahoo dsl. Please respond if you know how to fix this ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com ...