+ Reply to Thread
Results 1 to 13 of 13

Excel Match Offset formula in VB for dynamic range

  1. #1
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    231

    Excel Match Offset formula in VB for dynamic range

    Hi,

    I have a Match offset function written in Excel VB.

    The maximum number of cells that the formula can go to is 2000.

    But, I am looking to have the formula dynamic.

    Eg: if I submit one value in C8, I see the result in B8 as per the formula.

    But, I see formula from B8 to B2000 cells. I want the formula to appear based on the source cell.

    For eg. If I have values in C8,C9 and C10, the formula should be in B8, B9 and B10.

    I do not need the formula to come till B2000. Is there a way I can make it dynamic. Below is the code for the range.


    Range("B8").Select
    Selection.AutoFill Destination:=Range("B8:B2000"), Type:=xlFillDefault
    Range("B8:B2000").Select
    Range("B2000").Select

    Thanks in advance

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,963

    Re: Excel Match Offset formula in VB for dynamic range

    ...If [you] have values in C8,C9 and C10, ... Will the remaining cells, C11,... be empty?
    Ben Van Johnson

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,963

    Re: Excel Match Offset formula in VB for dynamic range

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    231

    Re: Excel Match Offset formula in VB for dynamic range

    yes. If C11 is empty, B11 should be empty. If we have value in C11, then B11 should populate Match value based on C11. Column C is a drop down.

  5. #5
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    231

    Re: Excel Match Offset formula in VB for dynamic range

    Hi Leah,

    Thanks for the code.

    When I tried this I do not see formula for B8 as well.

    Please let me know if I missed out anything.

  6. #6
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,963

    Re: Excel Match Offset formula in VB for dynamic range

    Well, I tried to create my own test file. Please post one...

  7. #7
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    231

    Re: Excel Match Offset formula in VB for dynamic range

    Hi Leah,

    Attached the sample excel.
    Attached Files Attached Files

  8. #8
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    Win10/MSO2016
    Posts
    12,963

    Re: Excel Match Offset formula in VB for dynamic range

    Your vba is password protected

  9. #9
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Excel Match Offset formula in VB for dynamic range

    I suggest doing away with formulas...Make use of VBA...Code in Template Sheet Module
    Also having an entire column with data validation is just crazy...Populate this column once needed only...
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by Sintek; 04-19-2022 at 10:09 AM.
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  10. #10
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    231

    Re: Excel Match Offset formula in VB for dynamic range

    Hi,

    The file was extremely helpful. Thanks.

    Couple of things I noticed are

    1. It is not working when I copy paste multiple values in Col J.
    2. When I delete value from Col J, value in Col B does not get deleted.

    Attached the file.

    Can you please let me know if i am missing anything.

    Thanks in advance.
    Attached Files Attached Files
    Last edited by BMD4; 04-22-2022 at 02:16 PM.

  11. #11
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Excel Match Offset formula in VB for dynamic range

    1. It is not working when I copy paste multiple values in Col J.
    As theses were dropdowns, I assumed this would be the only method of entering a value

    2. When I delete value from Col J, value in Col B does not get deleted.
    This does delete the value in Col B


    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    07-04-2018
    Location
    Dallas
    MS-Off Ver
    MS 365 Version 2302
    Posts
    231

    Re: Excel Match Offset formula in VB for dynamic range

    Thanks. I tried the code. However, I do not see values populating in column B. Attached the excel.

    Please let me know if I missed out anything.
    Attached Files Attached Files

  13. #13
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Excel Match Offset formula in VB for dynamic range

    All works as it should...
    If I select in Col J...B is populated...
    If I paste into Col J...All B is populated...
    If I clear Col J...B is cleared...

    Not sure what process you are doing...
    Last edited by Sintek; 04-24-2022 at 06:46 AM.

+ 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] Dynamic Name Range using Offset&Match with Match based off a different column
    By mdlpjr in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-16-2013, 06:33 PM
  2. [SOLVED] Need a Dynamic Named Range; Offset/Match using 2 Columns
    By Kalithro in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 08-18-2013, 06:54 AM
  3. using offset function to create dynamic range based on a match search
    By freddiethomas in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 02-08-2013, 05:34 AM
  4. using offset function to create dynamic range based on a match search
    By freddiethomas in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2013, 04:14 AM
  5. Offset and Match in Dynamic Range
    By goldenbear10 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-01-2009, 09:54 PM
  6. Dynamic Range using OFFSET MATCH
    By penfold in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-01-2009, 10:24 AM
  7. [SOLVED] Dynamic Range, Data Validation and Address, Match and Offset Funct
    By rudawg in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-28-2006, 11:25 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