Results 1 to 6 of 6

Macro identifying tomorrow column as "today", then filling Thursday's column

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    01-16-2012
    Location
    England
    MS-Off Ver
    MS 365
    Posts
    1,398

    Macro identifying tomorrow column as "today", then filling Thursday's column

    Attached Code should find the column on the MASTER sheet dated today (Col T) and fill each cell where the file number in Col D matches a file in Col D of the TODAY sheet.

    It's picking up the correct row, but then identifies "today" as Column U (tomorrow's date), but then "filling" Column X, which is Thursday!

    Option Explicit
    Dim a As Long, f As Long, x As Long, y As Long
    Dim FindString As String
    Dim Rng As Range, Rng2 As Range
    
    Sub MATCHUP()
    
        With Sheet2
        f = .Cells(.Rows.Count, "D").End(xlUp).Row
        
            For a = 2 To f
            FindString = .Range("D" & a)
                If Trim(FindString) <> "" Then
                    With Sheets("MASTER").Range("D:D") 'searches all of column D
                    Set Rng = .Find(What:=FindString, _
                            After:=.Cells(.Cells.Count), _
                            LookIn:=xlValues, _
                            LookAt:=xlWhole, _
                            SearchOrder:=xlByRows, _
                            SearchDirection:=xlNext, _
                            MatchCase:=False)
                                If Not Rng Is Nothing Then
                                x = Rng.Row                                      
                                y = WorksheetFunction.Match(CLng(CDate(Now)), Range("2:2"), 0)
                                .Cells(x, y).Select
                                    With Selection.Interior
                                    .Pattern = xlSolid
                                    .PatternColorIndex = xlAutomatic
                                    .ThemeColor = xlThemeColorAccent4
                                    .TintAndShade = 0.599993896298105
                                    .PatternTintAndShade = 0
                                    End With
                                
                                End If
                    End With
                                                
                End If
            
            Next
        
        End With
    
    End Sub
    No idea why, so all suggestions, recommendations and alternatives welcome as ever.

    Ochimus
    Attached Files Attached Files
    Last edited by Ochimus; 04-08-2018 at 02:00 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Column X-Ref list - Sheet1 Col A "pages", Col B:FL "Req" to Sheet2 ColA "req", ColB "page"
    By excel-card-pulled in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 04-07-2017, 09:30 AM
  2. [SOLVED] Excel Macro - Help with IF statement (IF column C = "VH*", paste "*" into column D, othe
    By michaelranderton in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-10-2017, 10:30 AM
  3. [SOLVED] Macro To Look at list of files in column "A" and show their last Saved Date in Column "B"
    By drknot in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-29-2015, 09:48 AM
  4. [SOLVED] Count "ONLY" dates (Today/Tomorrow in filtered view viisable)
    By MBCMDR in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 07-31-2015, 02:27 PM
  5. Macro to copy cells from workbook,where column C is = "num1" AND Column D ="num2"
    By jarious87 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-10-2013, 03:30 PM
  6. [SOLVED] filling cell in column "a" if data present in column "b" issue.
    By timmatthews in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-07-2013, 11:43 AM
  7. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 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