+ Reply to Thread
Results 1 to 2 of 2

Passing a variable through a variable?

  1. #1
    Forum Contributor
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    358

    Passing a variable through a variable?

    How can I do something like this:

    Please Login or Register  to view this content.
    Any thoughts?

    I basically want to call a variable "HighAsk(x)" inside for loops that references: Sheet2.Cells(x,y) so it makes for reading my code a lot easier!

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,827

    Re: Passing a variable through a variable?

    I am not sure I understand what you want to do.

    The error that statement gives me is "Sub or Function not defined" referring specifically to the "Highask(x)" part. That could be because you did not post the entire code and you have somehow defined what highask(x) means elsewhere. A type mismatch error suggests that highask() is defined or dimensioned in some way that is incompatible with that cell's value.

    My first impression is that you want highask() to be an array, and you are trying to load that array with the values in column 3. Simply adding
    Please Login or Register  to view this content.
    to the code snippet above, the code runs without error and highask(9) contains whatever is in C9 of the specified sheet.

    Look at how you are dimensioning or defining highask() and see if that suggests a solution.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Passing a variable from one Sub to another
    By Magnus360x in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-28-2014, 04:12 PM
  2. Passing Variable from one sub to another
    By bbmak in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-27-2014, 12:39 PM
  3. passing variable name...
    By zara_toustra in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-18-2013, 01:15 PM
  4. Passing a variable from one sub to another sub
    By NRMDU in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-25-2013, 04:45 PM
  5. passing variable?
    By leroiv in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-06-2008, 10:52 AM
  6. [SOLVED] Passing variable to Access
    By Job in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2005, 11:05 AM
  7. [SOLVED] Passing variable to VarType of other Variable
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-22-2005, 10:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1