+ Reply to Thread
Results 1 to 4 of 4

VBA to copy and past certain data to another sheet is not working. Any ideas?

  1. #1
    Registered User
    Join Date
    08-05-2019
    Location
    Dallas, TX
    MS-Off Ver
    Microsoft 2016
    Posts
    6

    VBA to copy and past certain data to another sheet is not working. Any ideas?

    Private Sub CommandButton1_Click()
    a = Worksheets("Record Book").Cells(Rows.Count, 1).End(xlUp).Row

    For i = 2 To a

    If Worksheets("Record Book").Cells(i, 3).Value = "Sold" Then
    Worksheets("Record Book").Rows i.Copy
    Worksheets("Record Book 3").Activate
    b = Worksheets("Record Book 3").Cells(Rows.Count, 1).End(xlUp).Row
    Worksheets("Record Book3").Cells(b + 1, 1).Select
    ActiveSheet.Paste
    Worksheets("Record Book").Activate

    End If

    Next

    Application.CutCopyMode = False

    ThisWorkbook.Worksheets("Record Book").Cells(1, 1).Select

    End Sub

  2. #2
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,527

    Re: VBA to copy and past certain data to another sheet is not working. Any ideas?

    Probably because you have a space before the 3 at one point and not at the other.
    And "Rows i" is wrong also.
    Could you please read the forum rules about code tags and act accordingly.
    Thanks

    You might want to try this.
    Please Login or Register  to view this content.
    You can run this code from any worksheet.
    Last edited by jolivanes; 08-10-2019 at 11:23 PM. Reason: Add code and info

  3. #3
    Registered User
    Join Date
    08-05-2019
    Location
    Dallas, TX
    MS-Off Ver
    Microsoft 2016
    Posts
    6

    Re: VBA to copy and past certain data to another sheet is not working. Any ideas?

    Thank you!

  4. #4
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,527

    Re: VBA to copy and past certain data to another sheet is not working. Any ideas?

    Thanks for coming back to us and letting us know Cody.
    Good Luck

+ 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] copy and past data from one sheet to another giving me run time error 1004
    By damngroundhog in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-06-2019, 10:16 AM
  2. [SOLVED] macro to copy data range from sheet and past to specific other sheets
    By saravanan1981 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-31-2017, 05:31 AM
  3. Copy and Past not working correctly
    By nkb80 in forum Excel General
    Replies: 1
    Last Post: 01-03-2013, 02:59 PM
  4. [SOLVED] Seach for data from one sheet to another sheet and copy past adjacent columns
    By mahtabshaikh in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-19-2012, 10:19 AM
  5. Replies: 2
    Last Post: 09-04-2012, 01:19 AM
  6. Replies: 1
    Last Post: 02-28-2012, 01:35 AM
  7. Replies: 1
    Last Post: 02-25-2012, 09:16 AM

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