+ Reply to Thread
Results 1 to 9 of 9

VBA to match cell value then move range to sheet name that matches

  1. #1
    Registered User
    Join Date
    03-26-2018
    Location
    Maryland
    MS-Off Ver
    2016
    Posts
    25

    VBA to match cell value then move range to sheet name that matches

    Good Day,

    I've got a report that goes out with five sheets within the workbook. To start we export a pre-packaged report from our system (Sheet 1). We then create 5 additional sheets each with their own unique name. We then look at the cell value in Column F and if it matches one of the sheet names then we cut&paste that entire row into the next available row within that sheet. Once all of the rows from Sheet 1 have been distributed to one of the other five sheets we delete Sheet 1 so you're just left with the five sheets.

    is that clear? I hope so!

    I need a piece of VBA to add into the rest of my Macro to do this if I can.

    thanks for your help

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    3,617

    Re: VBA to match cell value then move range to sheet name that matches

    I assume the column F you refer to is in Sheet1. Is that correct? Will there ever be any values in column F that do not have a corresponding sheet with the same name?
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    03-26-2018
    Location
    Maryland
    MS-Off Ver
    2016
    Posts
    25

    Re: VBA to match cell value then move range to sheet name that matches

    Yes: Column F is in Sheet 1. Yes: there are times where the value is not found in any of the sheets. In that case I'd like to leave the Sheet 1. (I don't need the Macro to delete Sheet 1 at all, I can do that manually)

    THANKS!

  4. #4
    Forum Expert
    Join Date
    09-10-2017
    Location
    Chippenham
    MS-Off Ver
    2013
    Posts
    1,695

    Re: VBA to match cell value then move range to sheet name that matches

    How about
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-26-2018
    Location
    Maryland
    MS-Off Ver
    2016
    Posts
    25

    Re: VBA to match cell value then move range to sheet name that matches

    Doesn't do anything after executing.

  6. #6
    Forum Expert
    Join Date
    09-10-2017
    Location
    Chippenham
    MS-Off Ver
    2013
    Posts
    1,695

    Re: VBA to match cell value then move range to sheet name that matches

    Did you get any error messages?
    Also what are your sheet names & is the data in col F an exact match to the sheet names?

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    3,617

    Re: VBA to match cell value then move range to sheet name that matches

    Copy/paste the following into a regular module and run from there:
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    03-26-2018
    Location
    Maryland
    MS-Off Ver
    2016
    Posts
    25

    Re: VBA to match cell value then move range to sheet name that matches

    Looks like it works great!! thanks!

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010
    Posts
    3,617

    Re: VBA to match cell value then move range to sheet name that matches

    Glad it worked out.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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