+ Reply to Thread
Results 1 to 14 of 14

Problem Moving Data from one Sheet to Another

  1. #1
    Registered User
    Join Date
    06-12-2013
    Location
    Poughkeepsie, NY
    MS-Off Ver
    Excel 2003
    Posts
    36

    Problem Moving Data from one Sheet to Another

    Hello ExcelForum,

    I am writing a macro for data transfer from one sheet to another in Excel 2003 and so far this is what I have;

    Please Login or Register  to view this content.
    But when I run that code, it stops at the first

    Please Login or Register  to view this content.
    and tells me that the subscript is out of range.


    If I get rid of the

    Please Login or Register  to view this content.
    it works fine for the first selection as long as I start on the "P" sheet, but messes up the rest.

    Please let me know how to properly select each sheet so I can transfer the data correctly.

    Thanks!!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Problem Moving Data from one Sheet to Another

    Please Login or Register  to view this content.

    not in excel so not tested.
    Hope this helps

    Sometimes its best to start at the beginning and learn VBA & Excel.

    Please dont ask me to do your work for you, I learnt from Reading books, Recording, F1 and Google and like having all of this knowledge in my head for the next time i wish to do it, or wish to tweak it.
    Available for remote consultancy work PM me

  3. #3
    Registered User
    Join Date
    06-12-2013
    Location
    Poughkeepsie, NY
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Problem Moving Data from one Sheet to Another

    Same error occurred "Subscript is out of Range" with that code.

  4. #4
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Problem Moving Data from one Sheet to Another

    Have you definately got a sheet called P????

  5. #5
    Registered User
    Join Date
    06-12-2013
    Location
    Poughkeepsie, NY
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Problem Moving Data from one Sheet to Another

    Ah there's the problem. It's titled "P", not P. Is there any way to recall that sheet if it's in quotations or do the quotations have to go?

  6. #6
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Problem Moving Data from one Sheet to Another

    double them up or use chr(34) & "P" & chr(34)

  7. #7
    Registered User
    Join Date
    06-12-2013
    Location
    Poughkeepsie, NY
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Problem Moving Data from one Sheet to Another

    Awesome, Chr(34) worked. Thanks so much!

  8. #8
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Problem Moving Data from one Sheet to Another

    no problems.

    Give us some reputation :o)

  9. #9
    Registered User
    Join Date
    06-12-2013
    Location
    Poughkeepsie, NY
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Problem Moving Data from one Sheet to Another

    Oh! One more quick question, would it be possible to compile the ranges into one line instead of having a 6 line code for each line?

    Here's the basic code for on line
    Please Login or Register  to view this content.
    The next one would be
    Please Login or Register  to view this content.

  10. #10
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Problem Moving Data from one Sheet to Another

    Yes, using the code i sent.

    Please Login or Register  to view this content.
    or you could do
    Please Login or Register  to view this content.
    not tested as not in excel.

    Then
    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    06-12-2013
    Location
    Poughkeepsie, NY
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Problem Moving Data from one Sheet to Another

    Sorry, I should have worded this better. I meant the copying aspect all in one line. As in, I would like to copy all of these ranges that change by 21 rows each time in one line and then paste them into the appropriate spot. There are MANY different things that need to get copied and this could get very huge, very quickly.

    Or is this not possible to copy the various rows because they are not consecutive?
    Last edited by vbaNewbieMan; 06-11-2014 at 10:51 AM.

  12. #12
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Problem Moving Data from one Sheet to Another

    Sheets("P").Range("E68:S68").copy detination:=Sheets("PDat").Range("C46")

    same ansa

  13. #13
    Registered User
    Join Date
    06-12-2013
    Location
    Poughkeepsie, NY
    MS-Off Ver
    Excel 2003
    Posts
    36

    Re: Problem Moving Data from one Sheet to Another

    Got it, sorry I had a brain fart and entered it in wrong. Thank you so much for all the help with this. Much obliged.

  14. #14
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Problem Moving Data from one Sheet to Another

    No worries, i have brain e-coli sometimes :o)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] problem with moving data to new sheet when row A of new sheet does not have data
    By CityInspector in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-23-2012, 09:16 AM
  2. Replies: 2
    Last Post: 10-09-2012, 08:40 PM
  3. Replies: 2
    Last Post: 03-23-2009, 10:17 AM
  4. Problem moving data between worksheets
    By Timeferret in forum Excel General
    Replies: 3
    Last Post: 02-10-2009, 05:29 AM
  5. [SOLVED] Problem moving data
    By Metrazal in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-27-2006, 06:15 PM

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