+ Reply to Thread
Results 1 to 11 of 11

Copying Data to Specified Sheet in another Workbook

  1. #1
    Registered User
    Join Date
    07-22-2007
    Posts
    27

    Copying Data to Specified Sheet in another Workbook

    Hello All
    I am working in two workbooks and what I need to do is copy four columns from one workbook to a specified (user defined by input field) tab in another workbook.
    For instance copy data in B1 thru E10 in workbook "Generation" to workbook "Monthly Data" tab "March or any month selected"
    The problem is I would like a input box to select the correct tab by the user, each tab is named the month, so you could select which month. It would then paste the data into the correct month, range G1 thru J10.

    Thanks for any and all help

    Kenny

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525
    Quote Originally Posted by kdraper
    The problem is I would like a input box to select the correct tab by the user, each tab is named the month, so you could select which month.
    Try something like this...
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-22-2007
    Posts
    27

    Thanks jindon

    I tried your suggestion but it did not work.
    The sheets in the second workbook are named by the month.
    I want the user to select the correct month by using the inputbox so the data is pasted into the correct sheet.

    Thanks for your quick response.

    Kenny

  4. #4
    Registered User
    Join Date
    07-22-2007
    Posts
    27

    Current code

    This is the code I am using but the selecting a defined sheet (Jan, Feb or Mar) is not working.
    HTML Code: 
    Hope this helps

    Thanks

    Kenny

  5. #5
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Try this
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  6. #6
    Registered User
    Join Date
    07-22-2007
    Posts
    27
    Thanks for your quick response and help royUK
    The inputbox comes up and I can enter anything and the code stops there with no errors and it has not pasted anything into the b.xls spreadsheet.
    Here is what I am currently using.

    HTML Code: 
    Thanks for any additional help

    Kenny

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Are your workbooks called a and b? The code I wrote works fine on test books using the name you said in the first post.

  8. #8
    Registered User
    Join Date
    07-22-2007
    Posts
    27
    royUK,

    The workbooks are called a and b to simplify things.
    I want to take data from workbook a and copy it to workbook b.
    Workbook b has 12 tabs one for each month.
    When copying the data from workbook a to workbook b I need to make sure it gets put in the correct month. I want the user to enter the month for Jan, Feb Mar or whatever month is correct. When a month is entered in the inputbox it will then make that month/sheet active and paste the data into it. If something other than Jan, Feb, Mar, etc is entered into the field I would like for a message to say something like that is not a valid sheet name, please try again.

    I hope this helps, I appreciate your understanding and patience with me.

    Thanks

    Kenny

  9. #9
    Registered User
    Join Date
    07-22-2007
    Posts
    27
    I also get the following message:

    Run time error 91
    Object variable or With block variable not set

    which is look ing at the following line of the code:
    HTML Code: 
    I hope this helps

    Kenny

  10. #10
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by kdraper
    royUK,

    The workbooks are called a and b to simplify things.
    I want to take data from workbook a and copy it to workbook b.
    Workbook b has 12 tabs one for each month.
    When copying the data from workbook a to workbook b I need to make sure it gets put in the correct month. I want the user to enter the month for Jan, Feb Mar or whatever month is correct. When a month is entered in the inputbox it will then make that month/sheet active and paste the data into it. If something other than Jan, Feb, Mar, etc is entered into the field I would like for a message to say something like that is not a valid sheet name, please try again.

    I hope this helps, I appreciate your understanding and patience with me.

    Thanks

    Kenny
    That's what my code is doing for me. I can only think that your workbooks or sheet names are incorrect, or you are pasting the code into the wrong workbook.

  11. #11
    Registered User
    Join Date
    07-22-2007
    Posts
    27
    This is what I am using now but it only pastes the data in the active sheet, not a sheet I select in the inputbox.

    HTML Code: 
    Thanks

+ 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