+ Reply to Thread
Results 1 to 5 of 5

Help with Code: Timestamp a column under two criteria

  1. #1
    Forum Contributor
    Join Date
    08-22-2017
    Location
    USA
    MS-Off Ver
    2016 WINDOWS and MAC
    Posts
    294

    Help with Code: Timestamp a column under two criteria

    Hi,

    I currently have some code that timestamps a column if the value of the target cell becomes > 0. I attempted to further the code where if a different cell is greater equal a value, the timestamp would also occur.
    CODE:

    Please Login or Register  to view this content.
    It does not work. The above code is also confusing, as it uses Integers to represent columns. I would prefer if I could just establish the column's letter reference to alter my code.

    In essence, what I am trying to achieve is...

    If a cell in column S becomes greater than 0, then timestamp (i.e. 'Now()') in column X
    If a cell in column H equals the word "DOWNTIME" then time stamp in column X
    If a cell in Column B has text, then stamp the DATE in xx/xx/xxxx format in column D



    Any help would be appreciated by the VBA gurus!

    Thank you

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Help with Code: Timestamp a column under two criteria

    Can you explain how these cells are changing?

  3. #3
    Forum Contributor
    Join Date
    08-22-2017
    Location
    USA
    MS-Off Ver
    2016 WINDOWS and MAC
    Posts
    294

    Re: Help with Code: Timestamp a column under two criteria

    Quote Originally Posted by davesexcel View Post
    Can you explain how these cells are changing?
    Hi davesexcel,

    In more detail:

    There are many rows of data (blank). Each row has different fields to be entered by the user. When column S has a number in it entered by the user which is greater than 0, i would like column X to timestamp in the corresponding row with the Now() function.

    Likewise, if a cell in column H contains the word "DOWNTIME", which is entered by the user, then in the corresponding row, under column X i would also like a timestamp.

    Lastly, if Column B changes (i.e. has text in it - originally blank, user enters words) the current date is stamped in column D.


    Thanks

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Help with Code: Timestamp a column under two criteria

    This should work.

    Please Login or Register  to view this content.

  5. #5
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Help with Code: Timestamp a column under two criteria

    I would prefer if I could just establish the column's letter reference to alter my code.
    - function added to allow you to use column letter

    Place code in sheet module:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.
    How function works:
    - if target cell is A7
    - its address is $A$7
    - this address is split each time $ is encountered
    - it is split into its 2 components "A" and "7"
    - addr(1) is "A"
    - addr(2) is "7"
    Last edited by kev_; 01-04-2018 at 02:56 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

+ 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. Replies: 2
    Last Post: 11-09-2016, 02:23 PM
  2. how do I allow for 24:00 (2400) timestamp in my code ??
    By Dj Duck in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-27-2016, 08:24 PM
  3. VBA Code for Automatic Timestamp
    By Mhace in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-18-2015, 02:02 AM
  4. Identify Cells/ Rows based on Criteria and evaluated by Timestamp?
    By iskivt30 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-27-2014, 02:58 AM
  5. Replies: 18
    Last Post: 02-24-2014, 06:13 PM
  6. Problem with timestamp code
    By Rtoro in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2007, 03:12 AM
  7. Code for a timestamp.
    By Zirus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-15-2007, 01:10 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