1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Copy Worksheet Data

Discussion in 'Business Applications' started by jo15765, Dec 8, 2011.

Thread Status:
Not open for further replies.
  1. jo15765

    jo15765 Thread Starter

    Joined:
    Oct 11, 2011
    Messages:
    307
    I have a "Master" spreadsheet, and on that spreadsheet there are tab names that correspond with about 4 other worksheets. What I am wanting to do is copy the data from the worksheet, to the "Master" workbook's worksheet with the same worksheet name. I have this code:
    Code:
    Subscript out of range
    Set wb = Workbooks.Open(Filename:="R:\Test\Master.xls")
    
    Set wb = Workbooks.Open(Filename:="Z:\Test\Test1.xls")
    Sheets("January").Rows("3:200").Copy
    ActiveWorkbook("January.xls").Activate
    Sheets("January").Select
    Range("A3").Select
    ActiveSheet.Paste
    Range("A3").Select
    Set wb = Workbooks.Open(Filename:="Test2.xls")
    Sheets("Feb").Select
    Rows("3:1000").Select
    Selection.Copy
    Windows("Feb.xls").Activate
    Sheets("Feb").Select
    Range("A3").Paste
    Range("A3").Select
    
    But I keep getting a subscript out of range debug error. Can someone shed some light onto what is causing that error and what modifications need to be made so that the error doesn't continue?
     
  2. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,608
    First Name:
    Hans
    When and at which line of code do you get the problem?
    Have you tried running the macro step-by-step?

    Subscript out of range means that you're referring to something that is not there "out of range"

    Since I don't have your files and sheets it can be anything.
     
  3. jo15765

    jo15765 Thread Starter

    Joined:
    Oct 11, 2011
    Messages:
    307
    Apalogies I got this code working. And you are correct Keebellah I typed my worksheet name wrong. Gotta remember to use copy/paste. However, thank you for the support!
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1030406

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice