+ Reply to Thread
Results 1 to 4 of 4

pasting formula in a cell for a macro

  1. #1
    Registered User
    Join Date
    05-06-2014
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    2

    pasting formula in a cell for a macro

    While using a macro, I am trying to paste the following formula into cell J2:

    =IF(B2="258801",VLOOKUP(G2,Matrix!A:L,4,FALSE),IF(B2="258701",VLOOKUP(G2,Matrix!A:L,5,FALSE),IF(B2="258601",VLOOKUP(G2,Matrix!A:L,5,FALSE),IF(B2="258501",VLOOKUP(G2,Matrix!A:L,6,FALSE),IF(B2="258101",VLOOKUP(G2,Matrix!A:L,7,FALSE),IF(B2="252201",VLOOKUP(G2,Matrix!A:L,8,FALSE),IF(B2="258301",VLOOKUP(G2,Matrix!A:L,9,FALSE),"")))))))&IF(B2="258401",VLOOKUP(G2,Matrix!A:L,10,FALSE),IF(B2="258401",VLOOKUP(G2,Matrix!A:L,10,FALSE),""))

    When I begin recording my macro, even if that is the only thing I do, I still get an error when I try to begin recording, select the cell, click in to edit it, paste my fomula, and then stop recording.

    The error is as follows:

    Please Login or Register  to view this content.

    Can anyone help? Thank yoU!
    Last edited by arlu1201; 05-08-2014 at 10:01 AM. Reason: Use code tags.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: pasting formula in a cell for a macro

    Perhaps try
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-06-2014
    Location
    New Jersey
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: pasting formula in a cell for a macro

    This is great... thank you!

    Also, if I then want the macro to apply to all cells in J where there is a value in B (or any column before J for that matter), what would I update Range ("J2").Formula = WkStg to?

    I am trying to figure this out on the forums but it is hard to apply other solutions to my code seeing as I am a macro newb! Thanks so much for your help.

  4. #4
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: pasting formula in a cell for a macro

    Perhaps again, try and check
    Please Login or Register  to view this content.

+ 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. Macro Help with Pasting Formula Values
    By carden2 in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 09-21-2012, 05:29 PM
  2. [SOLVED] Pasting Formula with Macro
    By L2012 in forum Excel General
    Replies: 2
    Last Post: 09-17-2012, 12:45 PM
  3. [SOLVED] Pasting a certain formula in a cell using a macro
    By nenadmail in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-07-2012, 12:02 PM
  4. Pasting a Formula in a Macro
    By Alexander_Read in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-19-2008, 10:49 AM
  5. Pasting a value not a formula in a macro
    By Alec H in forum Excel General
    Replies: 1
    Last Post: 02-23-2006, 07:00 AM

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