+ Reply to Thread
Results 1 to 4 of 4

Cannot include copy paste in Macro

  1. #1
    Registered User
    Join Date
    09-16-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    2

    Post Cannot include copy paste in Macro

    Hello,
    I'm running Excel 2010 on a Windows 7 machine
    I'm trying to create a macro and in this macro it include a copy paste of a formula I have made

    It look like this in the macro

    Please Login or Register  to view this content.
    it works

    but now, I have created a new sheet in my Excel doc called Reserved PCs and I want to use it

    in Excel it looks like this and it works:

    =IF(C2='Reserved PCs'!$A$2,'Reserved PCs'!$B$2,IF(C2='Reserved PCs'!$A$3,'Reserved PCs'!$B$3,IF(C2='Reserved PCs'!$A$4,'Reserved PCs'!$B$4,IF(C2='Reserved PCs'!$A$5,'Reserved PCs'!$B$5,IF(C2='Reserved PCs'!$A$6,'Reserved PCs'!$B$6,IF(C2='Reserved PCs'!$A$7,'Reserved PCs'!$B$7,IF(C2='Reserved PCs'!$A$8,'Reserved PCs'!$B$8,IF(C2='Reserved PCs'!$A$9,'Reserved PCs'!$B$9,IF(C2='Reserved PCs'!$A$10,'Reserved PCs'!$B$10,IF(C2='Reserved PCs'!$A$11,'Reserved PCs'!$B$11,IF(C2='Reserved PCs'!$A$12,'Reserved PCs'!$B$12,IF(C2='Reserved PCs'!$A$13,'Reserved PCs'!$B$13,IF(C2='Reserved PCs'!$A$14,'Reserved PCs'!$B$14,IF(C2='Reserved PCs'!$A$15,'Reserved PCs'!$B$15,IF(C2='Reserved PCs'!$A$16,'Reserved PCs'!$B$16,IF(C2='Reserved PCs'!$A$17,'Reserved PCs'!$B$17,IF(C2='Reserved PCs'!$A$18,'Reserved PCs'!$B$18,IF(C2='Reserved PCs'!$A$19,'Reserved PCs'!$B$19,IF(C2='Reserved PCs'!$A$20,'Reserved PCs'!$B$20,IF(C2='Reserved PCs'!$A$21,'Reserved PCs'!$B$21,IF(C2='Reserved PCs'!$A$22,'Reserved PCs'!$B$22,IF(C2='Reserved PCs'!$A$23,'Reserved PCs'!$B$23,IF(C2='Reserved PCs'!$A$24,'Reserved PCs'!$B$24,IF(C2='Reserved PCs'!$A$25,'Reserved PCs'!$B$25,IF(C2='Reserved PCs'!$A$26,'Reserved PCs'!$B$26,IF(C2='Reserved PCs'!$A$27,'Reserved PCs'!$B$27,IF(C2='Reserved PCs'!$A$28,'Reserved PCs'!$B$29,IF(C2='Reserved PCs'!$A$29,'Reserved PCs'!$B$30,IF(C2='Reserved PCs'!$A$31,'Reserved PCs'!$B$31,"")))))))))))))))))))))))))))))

    In the macro it looks like this:

    Please Login or Register  to view this content.
    and if I run the macro, I got an error message (1004) --> Application defined or object defined error and the debug is pointing the formula as the problem

    Can you please let me know what could be wrong there?

    Moderator Note:

    Pls use code tags around your code next time as per forum rules.


    Thanks
    Last edited by Fotis1991; 09-17-2013 at 07:52 AM.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Cannot include copy paste in Macro

    Perhaps a simpler lookup formula to start with:

    =VLOOKUP(C2, 'Reserved PCs'!$A:$B, 2, 0)
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    09-16-2013
    Location
    Ireland
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Cannot include copy paste in Macro

    Quote Originally Posted by JBeaucaire View Post
    Perhaps a simpler lookup formula to start with:

    =VLOOKUP(C2, 'Reserved PCs'!$A:$B, 2, 0)
    Thanks very much, it works now. :-)

    I have another question about this macro but I will post it on a different post as it's not related to this issue

  4. #4
    Forum Expert Debraj Roy's Avatar
    Join Date
    09-27-2012
    Location
    New Delhi,India
    MS-Off Ver
    Excel 2013
    Posts
    1,469

    Re: Cannot include copy paste in Macro

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Regards!
    =DEC2HEX(3563)

    If you like someone's answer, click the star to give them a reputation point for that answer...

+ 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] Simple copy and paste macro- Paste special help needed.
    By hernancrespo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-20-2012, 07:02 AM
  2. [SOLVED] Macro to Find, copy, paste, find, copy, paste, find, copy, paste, u get the picture....
    By westsoldman in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-12-2012, 01:12 AM
  3. Looking portential formatting macro to include specific sales copy and paste.
    By lachy725 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-30-2012, 01:55 AM
  4. 2 Macro's: only vertical copy/paste action and copy-paste 14 columns to the right.
    By vdongen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-08-2010, 10:34 AM
  5. Copy and Paste macro needs to paste to a changing cell reference
    By loulou in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-24-2005, 07:06 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