+ Reply to Thread
Results 1 to 6 of 6

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

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

    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!

    Please Login or Register  to view this content.
    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.

  2. #2
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

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

    You are using a match to see where is the column with the right date.
    Use a FIND statement as you did for the file name
    Last edited by PCI; 04-08-2018 at 03:22 PM. Reason: Match explanation removed
    - Battle without fear gives no glory - Just try

  3. #3
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

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

    There is some sloppy references in your code..

    this is the entire code, the blue code lines have changed and 1 line above (select statement) was removed
    Please Login or Register  to view this content.
    in the Clng(Cdate(Now))-part Now is not only a date but also a time, the value of NOW is f.e. 43198,75 this was rounded up to 43199
    by using the vba command "Date" you only get wholenumbers like 43198, so no rounding errors

    the outcome of y is colomn 20 for april 8. but that is counting from column A.
    by using .Cells it moves 20 columns to the left from the starting position.
    You set the starting position to column D at the beginning of the first With statment
    ( With Sheets("MASTER").Range("D:D") 'searches all of column D)
    So for the second with statement you need to "reset" the starting point to column A
    also deleted the select and selection which is obsolete in (almost) any code.
    Last edited by Roel Jongman; 04-08-2018 at 02:39 PM.

  4. #4
    Forum Expert
    Join Date
    08-02-2013
    Location
    Québec
    MS-Off Ver
    Excel 2003, 2007, 2013
    Posts
    1,412

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

    By changing those 2 lines, it will work:

    Please Login or Register  to view this content.
    GC Excel

    If this post helps, then click the star icon (*) in the bottom left-hand corner of my post to Add reputation.

  5. #5
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

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

    You may use
    Please Login or Register  to view this content.

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

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

    Many thanks to everyone for the prompt help, and appreciate the constructive pointers about improving the coding, which will be taken on board.

    Now works seamlessly. so can mark this as "CLOSED".

    Ochimus

+ 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] 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