+ Reply to Thread
Results 1 to 2 of 2

VBA Logic Thread

  1. #1
    Registered User
    Join Date
    08-20-2018
    Location
    Mass, USA
    MS-Off Ver
    MS365 version 2303
    Posts
    28

    Question VBA Logic Thread

    Hi,

    I'm new to VBA and have been having trouble figuring out how to make this logic work between multiple sheets.
    Basically, I have two tables: One on Sheet A and one on Sheet B.

    Sheet A needs to be updated in a specific way to include some new data presented by sheet B.

    In this case, I ONLY care about updating Columns A and F in Sheet A.
    The logic would go as follows:

    If Sheet A column B = "Delete Item" then Delete Entire Row.

    If Sheet B Column B = "New Rev. Update!" then paste Sheet B Column F into Sheet A column F.
    If Sheet B Column B = "Missing Item" and Sheet B Column C = "PCBA Comp" or "Cab Assem Comp" then SKIP THIS ITEM
    If Sheet B Column B = "Missing Item" and Sheet B Column C = "Comp", then Copy entire row from Sheet B and paste it into the Bottom of Sheet A


    I know this is a lot, but I could use some hints!
    Thanks!!!



    ExampleIMAGE.png
    Attached Files Attached Files

  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: VBA Logic Thread

    The approach I generally use is to use an Advance Filter on the Data
    e.g.
    Either
    Sheet1.Range("Data").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Sheet2.Range("DataOut"), CriteriaRange:=Sheet2.Range("crit")
    Or
    Sheet1.Range("Data").AdvancedFilter Action:=xlFilterInPlace, CriteriaRange:=Sheet2.Range("crit")

    The above uses a range called "Crit" so use a helper column or columns in your "Data" range to identify the particular rows you want to filter.

    Then use code like

    Range("Data").SpecialCells(xlCellTypeVisible).Offset(1,0).Copy
    Range("A1").SpecialCells(xlCellTypeVisible).Offset(1,0).Rows.Delete
    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.

+ 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. Unanswered Thread search - remove "Moved" thread announcements from results
    By Roel Jongman in forum Suggestions for Improvement
    Replies: 4
    Last Post: 06-20-2018, 01:55 PM
  2. [SOLVED] Link of thread "Mark thread as solved" Sticky
    By ImranBhatti in forum Suggestions for Improvement
    Replies: 2
    Last Post: 02-14-2017, 08:31 AM
  3. "Locking" a free thread vs. "locking" a Commercial Services thread
    By 6StringJazzer in forum Suggestions for Improvement
    Replies: 1
    Last Post: 01-21-2016, 02:52 PM
  4. Vba logic help
    By 3drian in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 08-27-2015, 05:56 PM
  5. Suggestion-Thread Unread Notification For Editing/Change In Thread Title
    By :) Sixthsense :) in forum Suggestions for Improvement
    Replies: 5
    Last Post: 01-15-2014, 01:54 AM
  6. Replies: 1
    Last Post: 06-19-2012, 05:35 PM
  7. Previous Thread/Next Thread
    By ChemistB in forum ExcelTip.com Feedback / Comments / Suggestions
    Replies: 0
    Last Post: 01-31-2008, 10:32 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