+ Reply to Thread
Results 1 to 8 of 8

Macro for copying and duplicating data based on a cell values.

  1. #1
    Registered User
    Join Date
    02-26-2007
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    2007
    Posts
    22

    Question Macro for copying and duplicating data based on a cell values.

    I am trying to copy two cells from one worksheet to another in the same work book based on the value in Column B of one of the sheets. This is just a building block to a larger script I am going to create.

    Below is my attempt but I keep getting an error at Range(Cells(x, 3)).Select.

    Any help would be great.


    Please Login or Register  to view this content.
    Last edited by outthere; 08-25-2009 at 12:32 PM. Reason: solved

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro for copying and duplicating data based on a cell values.

    Maybe like this:
    Please Login or Register  to view this content.
    Last edited by shg; 08-22-2009 at 06:06 PM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    02-26-2007
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    2007
    Posts
    22

    Re: Macro for copying and duplicating data based on a cell values.

    I tried the code and i get a "Type Mismatch" Error at line:

    i = .Cells(x, 2)

    Any ideas?

    By the way, thanks for the help, I have a lot of learning to do!

  4. #4
    Registered User
    Join Date
    02-26-2007
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    2007
    Posts
    22

    Re: Macro for copying and duplicating data based on a cell values.

    I forgot to mention I am using Excel 2007 on Vista 64 Business, if that matters.

  5. #5
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Macro for copying and duplicating data based on a cell values.

    I tried the code and i get a "Type Mismatch" Error at line:

    i = .Cells(x, 2)
    Chances are the cell contain a non-numeric value.

  6. #6
    Registered User
    Join Date
    02-26-2007
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    2007
    Posts
    22

    Re: Macro for copying and duplicating data based on a cell values.

    You are correct. It contains a count formula, any chance of making it work around that or will i have to paste values in the cell?

  7. #7
    Registered User
    Join Date
    02-26-2007
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    2007
    Posts
    22

    Re: Macro for copying and duplicating data based on a cell values.

    Ok i fixed it, the reference cell for "i" was in the other worksheet:

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    02-26-2007
    Location
    Vancouver, BC, Canada
    MS-Off Ver
    2007
    Posts
    22

    Re: Macro for copying and duplicating data based on a cell values.

    Thanks for the help. I have posted a new issue in a new thread found here:

    http://www.excelforum.com/excel-prog...ml#post2152004

    I guess it's a bit of a continuation of this one but any help would be appreciated.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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