1. Welcome to Chandoo.org Forums. Short message for you

    Hi Guest,

    Thanks for joining Chandoo.org forums. We are here to make you awesome in Excel. Before you post your first question, please read this short introduction guide. When posting or responding to questions please remember our values at Chandoo.org are: Humility, Passion, Fun, Awesomeness, Simplicity, Sharing Remember that we have people here for whom English is not there first language and we need to allow for this in our dealings.

  2. Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User


  3. When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Converting VBA recorded macro to written macro

Discussion in 'VBA Macros' started by Aspur, Jan 11, 2019.

  1. Aspur

    Aspur New Member

    Hello All

    I am new to VBA. Most of my experience has been to record macros and then tweak them when they are simple. I am trying to convert a Vlookup recorded macro to one that is more dynamic with a named range.
    Code (vb):
    'Run Vlooukup in Colum H (cell h2) of Sheet "CompareToSchedule" (what the arugment is with wizard =VLOOKUP(D2,'GroupID''s '!B:H,7,FALSE)
       'ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-4],'GroupID '!C[-6]:C,7,FALSE)"
       'Selection.AutoFill Destination:=Range("H2:H40000")

    How can I convert this code so that I can use a named range in the GROUPID sheet.
  2. Chihiro

    Chihiro Excel Ninja

    Just replace the range...
    'GroupID '!C[-6]:C

    with your named range name.
  3. Aspur

    Aspur New Member

  4. Aspur

    Aspur New Member

    Well that worked like a charm!! Thank you.

Share This Page