+ Reply to Thread
Results 1 to 5 of 5

Pass Variable Cells into an Array Formula

  1. #1
    Registered User
    Join Date
    01-04-2011
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Question Pass Variable Cells into an Array Formula

    Hi, I'm rather new to VBA and EXCEL, I like to think I'm not an idiot but.... I'm stumped.

    I intigrated an array function i found online into a spreadsheet I'm using. I want to pass a variable cell range into that array formula and have it auto fill on my spreadsheet.

    I can get the code to work with set numbers (10) but not with the variable range. See below.

    Please Login or Register  to view this content.
    The array function takes the range you want to randomly select from and the number of unique values you want to return.

    where you see: "=randsfromrange(A1:A10,&10) I think i want it to look like "=randsfromrange(A1:A" & I & "," & I &")"

    This obviously isn't working.

    Any ideas?

    I was hoping this is an easy fix, but if you need more info please let me know.

    Thanks.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Pass Variable Cells into an Array Formula

    Hi ZLPROG
    can you use rc notation and does this work for you?
    Please Login or Register  to view this content.
    Last edited by pike; 01-05-2011 at 04:31 AM. Reason: "I" missing
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Pass Variable Cells into an Array Formula

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    01-04-2011
    Location
    Philadelphia, PA
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: Pass Variable Cells into an Array Formula

    Thanks for all the help guys.

    Pike unfortunately that code did not work. It is my understanding you can't auto fill an array formula.

    Bob I was able to tweek your code a bit and did get it to work, you had a few extra " marks.

    Here is the code that fixed the problem

    Please Login or Register  to view this content.
    Thanks again all. This is a great forum and I've only been a member 2 days :-)

    ......and I can't figure out how to markt his solved....

  5. #5
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Pass Variable Cells into an Array Formula

    Quote Originally Posted by ZLPROG View Post
    Bob I was able to tweek your code a bit and did get it to work, you had a few extra " marks.
    I thought that & looked odd, but it was in the formula that you said worked, so I included it

    Quote Originally Posted by ZLPROG View Post
    ......and I can't figure out how to markt his solved....
    At the top of the threads, there is an option called Thread Tools, it should be in there.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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