+ Reply to Thread
Results 1 to 5 of 5

Problem moving data to new workbooks

  1. #1
    Forum Contributor
    Join Date
    09-16-2004
    Posts
    100

    Problem moving data to new workbooks

    I receive a workbook with data which is divided into around 20 'region codes'. I have set up code to go through this for each potentioal region code and pull it into it's own workbook.

    The problem is that often on the original workbook, there is no entry for certain regions. Due to the way my code is set up (cos it's the only way I could think of to do it), it will still create a workbook for these regions.

    Is there a way to retain the functionality of the code, but have it NOT create a workbook if there is nothing to go into it?

    Please Login or Register  to view this content.
    Unfortunately, the region codes are not consecutive, so basically I have this code repeated 20 times, with changes to the region code each time.

    Any help to sort this would be greatly appreciated.

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967
    Have a look at the HELP for SELECT CASE
    Martin

  3. #3
    Forum Contributor
    Join Date
    09-16-2004
    Posts
    100
    Quote Originally Posted by mrice
    Have a look at the HELP for SELECT CASE
    Aha! That looks like it might do the trick (although odds are I'll be back for more help! )

    Cheers!

  4. #4
    Forum Contributor
    Join Date
    09-16-2004
    Posts
    100
    Knew I'd be back!!

    While Select Case works to a degree, the problem is that there are often several lines relating to a specific region, which all need to be copied into the region's specific sheet. For example:

    Data1 | Data2 | Region Code

    blah1 | blah2 | 1226
    blah1 | blah2 | 1226
    blah1 | blah2 | 1229
    blah1 | blah2 | 1229
    blah1 | blah2 | 1230

    Using the code that I've already got along with Select Case, it attempts to create a new workbook for each instance of a region number.

    Any ideas?

  5. #5
    Forum Contributor
    Join Date
    09-16-2004
    Posts
    100
    It's ok - I've solved it now. Not in the most elegant of ways, but it does what it's meant to.

    Cheers.

+ 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