Results 1 to 14 of 14

Highlight Rows which are NOT found.

Threaded View

theeachi Highlight Rows which are NOT... 03-01-2020, 08:41 PM
mehmetcik Re: Macro takes forever and... 03-01-2020, 09:17 PM
theeachi Re: Macro takes forever and... 03-01-2020, 09:24 PM
mehmetcik Re: Macro takes forever and... 03-01-2020, 09:25 PM
theeachi Re: Macro takes forever and... 03-02-2020, 07:02 AM
mehmetcik Re: Macro takes forever and... 03-01-2020, 09:48 PM
bakerman2 Re: Macro takes forever and... 03-02-2020, 03:36 AM
theeachi Re: Macro takes forever and... 03-02-2020, 07:07 AM
Pepe Le Mokko Re: find a row in sheet 1... 03-02-2020, 03:41 AM
theeachi Re: find a row in sheet 1... 03-02-2020, 06:16 AM
bakerman2 Re: Highlight Rows which are... 03-02-2020, 07:17 AM
theeachi Re: Highlight Rows which are... 03-02-2020, 07:40 AM
mehmetcik Re: Highlight Rows which are... 03-02-2020, 08:12 AM
jindon Re: Highlight Rows which are... 03-02-2020, 09:21 AM
  1. #1
    Registered User
    Join Date
    02-23-2020
    Location
    Oldham, England
    MS-Off Ver
    O365
    Posts
    9

    Highlight Rows which are NOT found.

    Hi all, I am very new to VBA and struggling to make sense of it all!!

    I am trying to help my wife with a spreadsheet she uses a lot. Basically I need to find a row in sheet 1 (Tracking) where Column B is the same in both and where column G in sheet 2 (BL) matches column K in sheet 1, and if so, update the data in sheet 1 column W with the data from sheet 2 column I. Now I have already had help with that bit and it works a treat Thank you....

    Now I am trying to highlight any rows in sheet 2 which do not match....

    I have tried and it works on my test but when I run it on the actual spreadsheet (1 sheet has 8000 rows and one has 5000 rows) it takes forever and then crashes Excel! The OverwriteMatchedData function works fine its just the HighlightNotFound bit that breaks it, I was wondering if they can be combined?

    Can anyone help?? It would be greatly appreciated. My code is below:
    Sub OverwriteMatchedData()
        Dim mSh As Worksheet, sSh As Worksheet
        Dim i As Long, fRow
    
        
        Set mSh = Worksheets("Tracking")
        Set sSh = Worksheets("BL")
        
        With sSh.Cells(1).CurrentRegion
            For i = 2 To mSh.Range("B" & mSh.Rows.Count).End(xlUp).Row
                fRow = .Parent.Evaluate("match(""" & mSh.Range("B" & i) & """&""" & mSh.Range("K" & i) & _
                """," & .Columns(2).Address & "&" & .Columns(7).Address & ",0)")
                If Not IsError(fRow) Then mSh.Range("W" & i) = .Cells(fRow, 9)
            Next
        End With
    
    
        MsgBox "Matches updated"
    End Sub
    
    
    Sub HighlightNotFound()
        Dim Comp1, Comp2, x, y
            
            Comp1 = Sheets("Tracking").Cells(Rows.Count, "B").End(xlUp).Row
            Comp2 = Sheets("BL").Cells(Rows.Count, "B").End(xlUp).Row
                
                For x = 2 To Comp1
                    For y = 2 To Comp2
    
                        If Not Sheets("Tracking").Cells(x, "B") = Sheets("BL").Cells(y, "B") And _
                        Sheets("Tracking").Cells(x, "K") = Sheets("BL").Cells(y, "G") Then
                        Sheets("BL").Range("A" & y & ":I" & y).Interior.Color = RGB(255, 255, 0)
                        End If
                    Next y
                Next x
        MsgBox "Not Found Rows in BL Updated", vbOKCancel
    End Sub
    Attached Files Attached Files
    Last edited by theeachi; 03-02-2020 at 06:13 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Creating a macro to replace a formula that takes forever to calculate
    By PaulM100 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-03-2018, 09:49 AM
  2. [SOLVED] InStr macro takes forever.
    By taylorsm in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 12-06-2017, 10:40 AM
  3. Macro takes forever after upgrading from excel 20007 to 2010
    By Yigal in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 09-05-2014, 10:45 AM
  4. Macro Takes forever To Execute
    By daveyc18 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-16-2014, 11:14 AM
  5. Excel Sheet takes forever to save
    By JohnGault82 in forum Excel General
    Replies: 2
    Last Post: 02-09-2011, 04:41 PM
  6. Replies: 7
    Last Post: 12-19-2008, 10:57 PM
  7. hiding a few rows with a macro takes forever
    By Conor in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-09-2007, 06:34 PM

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