+ Reply to Thread
Results 1 to 8 of 8

VBA Copy Script

  1. #1
    Registered User
    Join Date
    01-13-2011
    Location
    Mansfield, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Unhappy VBA Copy Script

    Hi,

    I am a complete beginner at using VBA and all programming language is foreign to me.

    I am looking to compile a VBA script that will when called upon, copy rows from my main sheet into subsequent sheets based upon a particular value in a certain row.

    The sheet in question is a material sheet (steel etc). I have compiled a sheet with a drop down selection box for the type. I would like the VBA script to copy rows values of XX and YY into sheet 1 based on their value in type column. Also copy rows of values of SS and TT into sheet 2 based on their value in the type column, and finally copy rows AA, BB and CC into sheet 3 based on their value in type column, sort of like organising the sheet into different sections, not just a mismatch.

    The code I have made by muddling through is this:

    Please Login or Register  to view this content.
    This works for one variable as you can see in this case it is "H/R RHS", however i need to include "H/R RHS", "H/R SHS", "C/R RHS" and "C/R SHS" all to be pasted onto sheet RHS,

    Then All values of "Plate" in type column to sheet "plate only"

    and finally all values of any remaining variables to "MISC"

    Please help.

    I have attached a copy of my workbook for reference.
    Attached Files Attached Files
    Last edited by pike; 01-13-2011 at 07:26 AM. Reason: add code tags and PM OP

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: VBA Copy script Help Needed!!!

    I would like the VBA script to copy rows values of XX and YY into sheet 1 based on their value in type column. Also copy rows of values of SS and TT into sheet 2 based on their value in the type column, and finally copy rows AA, BB and CC into sheet 3 based on their value in type column,
    i need to include "H/R RHS", "H/R SHS", "C/R RHS" and "C/R SHS" all to be pasted onto sheet RHS,
    Your example does not have any of these sheets you mention.
    note:Okay I see you have all the sheets hidden, for some reason.
    Last edited by davesexcel; 01-13-2011 at 08:05 AM.

  3. #3
    Registered User
    Join Date
    01-13-2011
    Location
    Mansfield, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: VBA Copy script Help Needed!!!

    I meant i would like "H/R RHS", "H/R SHS", "C/R RHS" and "C/R SHS to be pasted onto sheet"Box Section", Plate variable onto sheet"Plate only" and the rest of the variables onto sheet"misc"

    Sorry for the confusion

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: VBA Copy script Help Needed!!!

    Your code should be in a regular module not the Workbook Module
    You can filter for more than 1 item at a time with xl'07
    Please Login or Register  to view this content.
    Where code goes

    Please update your profile to indicate you are using xl'07

  5. #5
    Registered User
    Join Date
    01-13-2011
    Location
    Mansfield, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: VBA Copy script Help Needed!!!

    Hi Dave, That code works thank you however when i run it, it edits the first sheet, that will still need to remain intact.

    Please help,

    Thanks

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: VBA Copy script Help Needed!!!

    Not possible, nothing in the code would do that, is the filter still on?

  7. #7
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,481

    Re: VBA Copy script Help Needed!!!

    What is the purpose of so many material list sheets?

  8. #8
    Registered User
    Join Date
    01-13-2011
    Location
    Mansfield, England
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: VBA Copy script Help Needed!!!

    yes i think the filter is still on, however i have very basic knowledge of working with these and i am not sure how to get it off.

    My original code did copy the cells but it was only based on one variable.

    I may have done it the long way round i don't know, but when i input all the material onto the sheet, it calculates the weight and price of them for my company. However my boss would like to see all the materials itemised to streamline ordering.

    Any help much 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