+ Reply to Thread
Results 1 to 11 of 11

VBA array based on =cell reference

  1. #1
    Registered User
    Join Date
    08-01-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    15

    VBA array based on =cell reference

    Ladies/Gents,

    I'm relatively new to VBA, I've been using it for around two months now creating a very big worksheet, I've managed to do most things up to now the "long way" around, but i'm fine with that and it works for me. However I've come up against the proverbial brick wall trying to find the output from an array based on two cells linked elsewhere in the worksheet. I just cant get anything to work!!!

    I'd prefer not to embarrass myself by showing the code i'm trying to use as it really is half cocked and not suitable for viewing by any body.

    The array is contained within B94:I107 (including headers) and the two cell values are C93 & D93 which are linked to another sheet by excel formula and eventually linked to an active X drop down box.

    Can anybody offer any pointers?

    Best rgds,

  2. #2
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: VBA array based on =cell reference

    This will load everything in that range sequentially into array()

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    08-01-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: VBA array based on =cell reference

    Thanks for the prompt reply, and apologies if i look a complete idiot (I probably am), I'm not sure how to use the above in context with what else i'm trying to achieve?

    Within B94:I107 there are minutes per foot of weld for different materials and thickness, C93 is the material selected in a drop down box on a different sheet & C94 is the thickness selected in a drop down box on a different sheet. How do I get the intersection from the 2 selections?

    Thanks in advance

  4. #4
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: VBA array based on =cell reference

    You could make two arrays and adjust them to reflect each column. The relationship would be reflected by the number col1(1) is relative to col2(1)

  5. #5
    Forum Contributor
    Join Date
    10-08-2010
    Location
    Texas
    MS-Off Ver
    Excel 2010
    Posts
    386

    Re: VBA array based on =cell reference

    I don't think i understand what you are trying to do, maybe post a sample?

  6. #6
    Registered User
    Join Date
    08-01-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: VBA array based on =cell reference

    Is my understanding of an array wrong? should I create 2 different arrays? i have a column of thicknesses and a row of materials and I need to find the intersection, should I be using an array?

    Apologies if my skill level is below basic I think its a terminology thing...

  7. #7
    Registered User
    Join Date
    08-01-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: VBA array based on =cell reference

    Table shown below, the upper values are linked to a drop box on another sheet and I need to find the intersection, sorry...

    13mm 316L
    SAW weld C/S Gr.5 ChMo Gr.11 ChMo 304L 316L 31803 32750
    10mm 20 20 20 20 20 24 24
    13mm 30 30 30 30 30 36 36
    16mm 40 40 40 40 40 48 48
    20mm 50 50 50 50 50 60 60
    25mm 55 55 55 60.5 60.5 71.5 71.5
    30mm 60 60 60 66 66 78 78
    35mm 70 70 70 77 77 91 91
    40mm 85 85 85 93.5 93.5 110.5 110.5
    45mm 95 95 95 104.5 104.5 123.5 123.5
    50mm 100 100 100 120 120 130 130
    60mm 120 120 120 144 144 168 168
    70mm 150 150 150 180 180 210 210
    75mm 180 180 180 234 234 252 252

  8. #8
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA array based on =cell reference

    To loop through a 2-dimention array

    You first upload the range in to an array
    'x = Range("B94:I107")
    Then you loop though the array to do something
    Please Login or Register  to view this content.
    Last edited by AB33; 08-01-2013 at 04:47 PM.

  9. #9
    Registered User
    Join Date
    08-01-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: VBA array based on =cell reference

    Thanks I "think" I understand the initial code dictating parameters, but as mentioned earlier I've tried to avoid Looping code as its too complicated for me at this stage... I dont understand what comes next in the 'your code here - section?

    The patience by everyone is much appreciated.

  10. #10
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: VBA array based on =cell reference

    Needhelp,
    If you want to avoid a loop, you should look at filter. If you can not use filter, you have left with two options, as far as looping is concerned. You can either loop through a range or an array. If you want to loop through an array, you first need to copy(Upload) the range in to an array and do something with it.
    If you want to access the elements with in the array, you need to loop through the array, no other way of accessing this parts of the array.
    The choice is yours dude

  11. #11
    Registered User
    Join Date
    08-01-2013
    Location
    England
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: VBA array based on =cell reference

    Thanks AB33, I've managed by using the index feature.

    rgds,

+ 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. Use cell value to reference sheet for array
    By Tasoli in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-09-2013, 11:04 AM
  2. [SOLVED] How to reference an entire row based on an indirect cell reference
    By echo_oscar in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-31-2012, 08:50 PM
  3. Display data reference from another worksheet based on cell reference
    By Drew123 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-18-2011, 03:52 PM
  4. Replies: 2
    Last Post: 02-17-2011, 04:00 PM
  5. Array based on reference similar to autofilter
    By CST in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-06-2011, 04:54 PM

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