+ Reply to Thread
Results 1 to 12 of 12

Copy selected cells/rows to another worksheet

  1. #1
    Forum Contributor
    Join Date
    03-22-2006
    Location
    UK
    MS-Off Ver
    Office 2013
    Posts
    275

    Copy selected cells/rows to another worksheet

    Hi all

    Firstly, I have posted this thread in this forum because I think that VBA is the only way of achieving the results that I need this time.

    I have done some searching for a solution but nothing matches my problem and my knowledge of VBA is zilch.

    I have set up the attached workbook to try to show the results that I need using the matching shaded cells in the worksheets.

    The first part of the problem is that all data in columns A, B, C & H (Input1) needs to be copied to columns A, B, C & F in Input2 with the addition of a Zero value in columns D & E (sample data lines 1 - 3).

    The second part of the problem is that all data in columns A, B, & F (Input2) where the cell in column C is equal to ZERO needs to be copied to columns A, B & C in Input 3 (sample data Lines 4 - 11).

    It would also be useful to be able to copy data in columns A, B, & F (Input2) where the cell in column C is NOT equal to ZERO to columns A, B & C in Input 3 (sample data Lines 12 - 25). However, there will be often be more than value in column C (Input2) dictated by the date in Column A and number in Column B. The value in Column F (Input2) will always be the same for each of those rows, so it does not need to be duplicated in Column C (Input3).

    This would have to be manually triggered by linking it to a button or menu item, not sure what would be the best option. As data is entered at various times of the week, the routine would either have to overwrite existing matching data or carry on from where it last finished!

    A tall order but hopefully it can be resolved in some way.

    TIA ...spellbound
    Attached Files Attached Files
    Last edited by VBA Noob; 09-06-2008 at 01:10 PM.

  2. #2
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    macro

    Hi
    attached file has a macro for your problem-1 Other problems I have not understood. I see no zeros in col C of input1 or 2. (I have deleted data to reduce file size.)
    Ravi
    Attached Files Attached Files
    Last edited by ravishankar; 09-07-2008 at 05:36 AM.

  3. #3
    Forum Contributor
    Join Date
    03-22-2006
    Location
    UK
    MS-Off Ver
    Office 2013
    Posts
    275
    Hi Ravi

    Thanks for your efforts to solve the first problem. I have put the module into a cut down version of my original TEST workbook but encountered a few problems.

    1) I have amended the number formatting to point to the correct worksheet however the code is also changing the colours/formats of Cloumns D, E & F (Input2).

    2) For some reason the code also leaves Column F (Input2) highlighted in copying mode, which has to be exited before carrying on.

    3) The biggest problem is that every time the code is run it overwrites existing data and in some cases duplicates data on Input2 as it copies all the cells (rows) from Input1 to Input2. Which is probably why you could not see the zeros in column C (Input2).

    This would cause major problems as this worksheet can have up to 15,000 or more rows of manually inputted data.

    I have put the examples of the zeros in Column C (Input2) on rows 70-77.

    TIA ...David (spellbound)

    PS: I am using Excel 2003 and the macro is linked to Ctrl+Q
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    12-19-2006
    Posts
    113
    Hi Spellbound,

    Check the attached file to see if it is want you want...
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    03-22-2006
    Location
    UK
    MS-Off Ver
    Office 2013
    Posts
    275
    Hi Jokacave

    Not sure if the file is corrupted but unable to try out your suggestion because all I get is an error message saying:

    Microsoft Excel cannot determine which row in your list or selection contains column labels, which are required for this command
    Hope you will be able to resolve this.

    TIA ...spellbound

    PS: I am using Excel 2003 if that helps.

  6. #6
    Forum Contributor
    Join Date
    12-19-2006
    Posts
    113
    Hi Spellbound,

    Just press OK and will appear a DATAFORM to insert the data.

  7. #7
    Forum Contributor
    Join Date
    03-22-2006
    Location
    UK
    MS-Off Ver
    Office 2013
    Posts
    275
    Hi Jokacave

    Thanks, will try it out over the next few days and get back to you.

    It looks like you have done a great deal of work on this for me, which I really appreciate.

    May not be able to do much until the weekend as I have a very heavy schedule this week.

    spellbound

  8. #8
    Forum Contributor
    Join Date
    12-19-2006
    Posts
    113
    Hi Spellbound,

    If the previous attached file is not what you want, check this one...
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    03-22-2006
    Location
    UK
    MS-Off Ver
    Office 2013
    Posts
    275
    Hi Jokacave

    Thanks for the new procedure.

    I'm working away today again but I hope to try out both solutions over the weekend.

    Regards ...spellbound

  10. #10
    Forum Contributor
    Join Date
    12-19-2006
    Posts
    113
    Hi Spellbound

    Say something...

    Regards

  11. #11
    Registered User
    Join Date
    06-03-2011
    Location
    Cape Town, South Africa
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: Copy selected cells/rows to another worksheet ignoring zero cells

    Hi I would like to copy cells from one worksheet to another but don't want to copy the cells in A1 that = zero

  12. #12
    Forum Contributor
    Join Date
    12-19-2006
    Posts
    113

    Re: Copy selected cells/rows to another worksheet ignoring zero cells

    Hi ethietz,

    Did you find any answer to your problem? Still need help?

+ 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. Copy from One Worksheet to Another Automatically
    By GrayHeadedMule in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-25-2011, 01:52 AM
  2. Copy 1 worksheet page from Workbook to Word using VBA
    By jennsuprgrl in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-02-2008, 12:09 PM
  3. excel worksheet copy formula
    By Cntrygrl in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 03-12-2007, 09:31 AM
  4. Replies: 6
    Last Post: 11-18-2006, 08:42 PM
  5. Worksheet copy problem
    By Willow in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-28-2006, 09:56 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