+ Reply to Thread
Results 1 to 7 of 7

Macro for button won't transfer data to another sheet

Hybrid View

titchroberts Macro for button won't... 10-16-2017, 07:16 AM
Richard Buttrey Re: Help debug code 10-16-2017, 07:32 AM
xlnitwit Re: Help debug code 10-16-2017, 07:46 AM
titchroberts Re: Help debug code 10-16-2017, 08:36 AM
Richard Buttrey Re: Help debug code 10-16-2017, 09:26 AM
titchroberts Re: Help debug code 10-16-2017, 10:37 AM
xlnitwit Re: Macro for button won't... 10-16-2017, 09:20 AM
  1. #1
    Registered User
    Join Date
    10-16-2017
    Location
    Yorkshire
    MS-Off Ver
    Office 10
    Posts
    3

    Re: Help debug code

    Quote Originally Posted by xlnitwit View Post
    Hi,

    You have a few issues there. First, you are using nextRow when you assigned a value to blankRow; second, you type x1up rather than xlUp; and third, it looks like you are sending the data the wrong way. I think your code should be
    Sub Copy()
    
        Dim nextRow As Long
        Dim wsGuest As Worksheet, wsITC As Worksheet, wsFeeding As Worksheet
        Set wsGuest = Sheets("Guestlist")
        Set wsITC = Sheets("ITC Open Day Return Sheet")
        Set wsFeeding = Sheets("Feeding and Accommodation")
    
        With wsGuest
            nextRow = .Cells(.Rows.Count, "B").End(xlUp).Row + 1
            .Range("E" & nextRow).Value = wsITC.Range("D5").Value
            .Range("F" & nextRow).Value = wsITC.Range("D7").Value
            .Range("C" & nextRow).Value = wsITC.Range("D9").Value
            .Range("B" & nextRow).Value = wsITC.Range("F5").Value
            .Range("D" & nextRow).Value = wsITC.Range("F7").Value
            .Range("G" & nextRow).Value = wsITC.Range("D13").Value
            .Range("H" & nextRow).Value = wsITC.Range("D14").Value
            .Range("I" & nextRow).Value = wsITC.Range("D15").Value
            .Range("J" & nextRow).Value = wsITC.Range("D16").Value
            .Range("K" & nextRow).Value = wsITC.Range("D17").Value
            .Range("L" & nextRow).Value = wsITC.Range("D19").Value
            .Range("M" & nextRow).Value = wsITC.Range("D21").Value
            .Range("N" & nextRow).Value = wsITC.Range("D26").Value
            .Range("O" & nextRow).Value = wsITC.Range("D29").Value
            .Range("P" & nextRow).Value = wsITC.Range("D32").Value
            .Range("Q" & nextRow).Value = wsITC.Range("F26").Value
            .Range("R" & nextRow).Value = wsITC.Range("F29").Value
            .Range("S" & nextRow).Value = wsITC.Range("F32").Value
            .Range("T" & nextRow).Value = wsITC.Range("D36").Value
            .Range("U" & nextRow).Value = wsITC.Range("F36").Value
        End With
        With wsFeeding
            nextRow = .Cells(.Rows.Count, "B").End(xlUp).Row + 1
            .Range("C" & nextRow).Value = wsITC.Range("D9").Value
            .Range("B" & nextRow).Value = wsITC.Range("F5").Value
            .Range("E" & nextRow).Value = wsITC.Range("D44").Value
            .Range("F" & nextRow).Value = wsITC.Range("D46").Value
            .Range("G" & nextRow).Value = wsITC.Range("D48").Value
            .Range("H" & nextRow).Value = wsITC.Range("D50").Value
            .Range("I" & nextRow).Value = wsITC.Range("D52").Value
            .Range("J" & nextRow).Value = wsITC.Range("D63").Value
            .Range("K" & nextRow).Value = wsITC.Range("D68").Value
            .Range("L" & nextRow).Value = wsITC.Range("D72").Value
        End With
    
    End Sub

    Thanks, it doesn't come up with a bug - but then it also doesn't transfer the data to the other worksheets. Any other suggestions on what it can be?

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Help debug code

    Quote Originally Posted by titchroberts View Post
    Thanks, it doesn't come up with a bug - but then it also doesn't transfer the data to the other worksheets. Any other suggestions on what it can be?
    Is a Data filter out of the question?
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    10-16-2017
    Location
    Yorkshire
    MS-Off Ver
    Office 10
    Posts
    3

    Re: Help debug code

    Quote Originally Posted by Richard Buttrey View Post
    Is a Data filter out of the question?
    I have tried that but because of the way the form is set up, the information doesn't sit in subsequent rows. It is more the information is in individual cells. But I can see how this would be easier.

+ 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. Debug this code
    By ShandArchive in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-17-2017, 09:25 AM
  2. Debug code
    By Human2014 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 01-03-2016, 07:27 PM
  3. Error in the code please debug it
    By kalyaaans in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 09-22-2014, 10:28 AM
  4. VBA Code Runs in Debug Mode But Returns Type Mismatch Error Outside Debug Mode
    By valerie.k.chiang in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2014, 03:48 PM
  5. [SOLVED] Debug: How to debug this code?
    By reach78 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-25-2013, 07:16 AM
  6. Debug the Code
    By macrogeek in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-17-2011, 06:45 AM
  7. HELP, trying to debug this code...
    By twofootgiant in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-18-2011, 12:05 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