Results 1 to 5 of 5

need help understanding this (macro generated) code

Threaded View

  1. #1
    Registered User
    Join Date
    07-16-2014
    Location
    melbourne australia
    MS-Off Ver
    office 365
    Posts
    41

    need help understanding this (macro generated) code

    Hey all

    Im working on automating a few processes. I consider myself pretty proficient with VBA and can write code from scratch buuuut im also very very very lazy. So one trick i like to do is record a macro, then edit the code to clean it up and add more functionality to it.

    Recently created a macro that creates a new column, adds a vlookup formula to a certain cell and then drags that cell down the column. That formula is as follows "=VLOOKUP(J2, Key!$B$1:$E$50, 3, FALSE)"

    In the VBA that was generated by recording a macro while entering the formula is: ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[5], Key!R1C2:R50C5, 3, FALSE)"

    Just wondering if someone could explain this difference to me? ive never seen this RC[5] or R1C2:R50C5 so im not sure what these mean. Can someone explain how this works? i mean, i understand that RC[5]=J2, but not sure how
    Last edited by beba420; 04-27-2023 at 05:30 PM. Reason: solved :)

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Understanding VBA Code
    By Moa88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-30-2019, 08:49 AM
  2. Understanding this code
    By vj2651 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-13-2018, 11:12 PM
  3. Add code in macro generated WB
    By igormigor in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-03-2016, 10:44 AM
  4. Macro Help - Update from one Spreadsheet to another, not understanding the code.
    By Dan_Calver in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-18-2015, 07:14 AM
  5. change macro code generated through recording
    By abraham30 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-09-2013, 02:38 AM
  6. Run-time error 1004 on macro generated code
    By BGiffin2004 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2011, 11:01 AM
  7. Tips required to speed up / streamline working code generated by macro recorder.
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2010, 11:24 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