+ Reply to Thread
Results 1 to 6 of 6

Combining VBA Codes

  1. #1
    Registered User
    Join Date
    07-05-2019
    Location
    Tulsa, OK
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    5

    Combining VBA Codes

    Good Afternoon!

    I am wanting to combine two separate but similar VBA codes into one. I am currently using the code below. What this does is identifies a value in the L:L column marked as Filled on the "Display" spreadsheet and moves that entire Row to the "Filled" Worksheet. I would like to add a code that identifies the value Submitted in the same L:L column on the "Display" worksheet and Copy then delete that entire row to another worksheet called "Submitted". Let me know if any of that makes sense or not.

    Please Login or Register  to view this content.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,950

    Re: Combining VBA Codes

    Two options use an autofilter and move the entire block at once; use Select Case to test each cell for filled, or....

    However, you need to attach a workbook with sample data to test with:


    (How to) Upload a Workbook directly to the Forum
    (please do not post pictures or links to worksheets)
    • Click Advanced next to "Post Quick Reply" button at the bottom right of the editor box.
    • Scroll down until you see "Manage Attachments",
    • Click the "Choose" button at the upper left (upload from your computer).
    • Select your file, click "open", click "upload"
    • Once the upload is completed the file name will appear below the input boxes in this window.
    • Close the Attachment Manager window.
    • Click "Submit Reply"
    Note: Please do not attach password protected workbooks/worksheets
    Ensure to disable any Workbook Open/Autorun macros before attaching!
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    07-05-2019
    Location
    Tulsa, OK
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    5

    Re: Combining VBA Codes

    I have attached the workbook.
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Cool Hi, try this …


    Try to replace all your worksheet module code by this one :

    PHP Code: 
    Private Sub Worksheet_Change(ByVal Target As Range)
        If 
    Target.Column 12 Then
            Select 
    Case Target.Value2
                   
    Case "Filled""Submitted"
                        
    Application.EnableEvents False
                        Me
    .UsedRange.Rows(Target.Row).Copy Sheets(Target.Value2).Cells(Rows.Count1).End(xlUp)(2)
                        
    Target.EntireRow.Delete
                        Application
    .EnableEvents True
            End Select
        End 
    If
    End Sub 
    Do you like it ? So thanks to click on bottom left star icon « Add Reputation » !

  5. #5
    Registered User
    Join Date
    07-05-2019
    Location
    Tulsa, OK
    MS-Off Ver
    Microsoft Office 365 ProPlus
    Posts
    5

    Re: Combining VBA Codes - Solved

    Works flawlessly!! Thank you so much for your help!!
    Last edited by BradleyCase; 07-05-2019 at 06:58 PM. Reason: Question was solved.

  6. #6
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Thumbs up


    You're welcome, thanks for the rep' !

+ 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] Combining vba codes
    By RJ1969 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-24-2019, 12:32 PM
  2. Need help combining two codes
    By kbenjamin827 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 01-09-2019, 05:03 PM
  3. Combining 2 VBA codes
    By watiwawa in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-09-2014, 02:20 AM
  4. Combining vba codes makes the previous codes broken !
    By MDPLUS in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-26-2013, 10:00 AM
  5. [SOLVED] Combining 2 codes?
    By bjcowen9000 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-19-2013, 02:48 PM
  6. [SOLVED] Help! combining 2 VBA codes
    By iamreese in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-29-2012, 07:24 AM
  7. Combining two VBA codes
    By kimokurt in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-04-2011, 10:05 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