+ Reply to Thread
Results 1 to 6 of 6

Private Sub not copying/pasting to second sheet

  1. #1
    Registered User
    Join Date
    02-20-2017
    Location
    des moines, iowa
    MS-Off Ver
    excel 2013
    Posts
    27

    Private Sub not copying/pasting to second sheet

    Hello all,
    I am new to VBA coding and am having issues with my workbook private sub not completing the tasks I've given it.

    I have a log to track the various progress stages of our part numbers (part numbers in column b). the master log has all part numbers, with data including the "condition", or status of the part (this is in column bm).
    I would like for excel to automatically run when the condition of a part is changed, and if it is changed to "Active," I would like the sub to look at sheet 2 ("Active") and if the the part number (column b) does not already exist in the active sheet, copy that entire row that has been changed. I would also like this to work dynamically, so if a part number were to change from "Active" to, say, "complete" I'd really like for the code to remove that part number row from the "active" worksheet.

    I have looked up various tutorials on class modules, private subs, workbook and worksheet modules, and have tried autofiltering the master data to copy over to the second sheet. As I have it now, the code is in the workbook module as a sheet change. I have both sheets dimensioned and am using the intersect application to determine the range to watch for changes. I try to test the code by changing random conditions, but when I look at the second sheet, nothing has been copied over, even though no errors pop up in my VBE.

    here is my current code in the workbook module:

    Please Login or Register  to view this content.
    I have attached my workbook so that you may see what I am talking about
    thank you so much for your time,
    Riley
    Attached Files Attached Files

  2. #2
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,519

    Re: Private Sub not copying/pasting to second sheet

    This should do it

    Please Login or Register  to view this content.
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  3. #3
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Private Sub not copying/pasting to second sheet

    Or Another attempt:

    Please Login or Register  to view this content.
    * I would have used the Worksheet_Change since only entries in the master are valid
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  4. #4
    Registered User
    Join Date
    02-20-2017
    Location
    des moines, iowa
    MS-Off Ver
    excel 2013
    Posts
    27

    Re: Private Sub not copying/pasting to second sheet

    Mike,
    thank you so much this works perfectly!! I made a slight change in the formula to fit my needs just a bit better
    If UCase(Target.Value) = "COMPLETE" Then
    what i changed it to
    Please Login or Register  to view this content.
    I appreciate your help! I have been trying to figure this out for months and you were able to do it in a fraction of the time!
    now, if i have a question that pertains to the same workbook, but does not necessarily deal with this particular issue, should i create a new post?
    again, thanks so much
    riley

  5. #5
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,519

    Re: Private Sub not copying/pasting to second sheet

    Either or of I guess

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Private Sub not copying/pasting to second sheet

    On second thought, do you want to let any entries be by your active sheet?
    If not then you may want to leave it in the Workbook_SheetChange.
    Otherwise, Mike's program is practically perfect!

+ 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. Copying and pasting to another sheet
    By MeggieDoodles in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-18-2016, 01:49 PM
  2. Replies: 8
    Last Post: 02-01-2016, 09:30 AM
  3. Copying & pasting a current region to another sheet w/o actually copying.....
    By Excel_vba in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2014, 09:08 PM
  4. Replies: 9
    Last Post: 05-13-2013, 05:43 AM
  5. Dynamic copying and pasting of rows from one sheet into another sheet
    By princesspeach in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-27-2013, 01:50 PM
  6. Copying All the visible Rows in the current sheet and pasting it to another sheet
    By vickyyar in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-18-2012, 08:46 AM
  7. VBA Copying and Pasting from One Sheet to Another
    By Monkeyboyz in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-29-2010, 09:53 AM

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