OilEconomist
Active Member
- Joined
- Dec 26, 2016
- Messages
- 421
- Office Version
- 2019
- Platform
- Windows
Thanks in advance for your assistance.
What would be the VBA code to replace the date and time in a string if they do not agree with what is in either the date column or string column.
Date: This is what appears because of the way I formatted it, but it’s still a date as when I look in the cell function box, it shows “7/20/2022”
Range(“A9”) = 2022-07-20, Wed
Time: This is what appears because of the way I formatted it and it has been changed from a time to a string.
Range(“B9”) = 02:09 PM EST
String
Range(“C9”) = James turned in assignment in on 2022-07-20, Wed @ 02:09 PM EST – It was early.
Example 1: Now say let’s say I update the date and time to:
Range(“A9”) = 2022-07-21, Thu
Range(“B9”) = 08:01 AM EST
I would like to change the String from:
Range(“C9”) = James turned in assignment in on 2022-07-20, Wed @ 02:09 PM EST – It was early.
To:
Range(“C9”) = James turned in assignment in on 2022-07-21, Thu @ 08:01 AM EST – It was early.
Example 2: Now let’s say I just update the date:
Range(“A9”) = 2022-07-21, Thu
I would like to change the String from:
Range(“C9”) = James turned in assignment in on 2022-07-20, Wed @ 02:09 PM EST – It was early.
To:
Range(“C9”) = James turned in assignment in on 2022-07-21, Thu @ 02:09 PM EST – It was early.
Example 3: Now let’s say I just update the time:
Range(“B9”) = 08:01 AM EST
I would like to change the String from:
Range(“C9”) = James turned in assignment in on 2022-07-20, Wed @ 02:09 PM EST – It was early.
To:
Range(“C9”) = James turned in assignment in on 2022-07-20, Wed @ 08:01 AM EST – It was early.
What would be the VBA code to replace the date and time in a string if they do not agree with what is in either the date column or string column.
Date: This is what appears because of the way I formatted it, but it’s still a date as when I look in the cell function box, it shows “7/20/2022”
Range(“A9”) = 2022-07-20, Wed
Time: This is what appears because of the way I formatted it and it has been changed from a time to a string.
Range(“B9”) = 02:09 PM EST
String
Range(“C9”) = James turned in assignment in on 2022-07-20, Wed @ 02:09 PM EST – It was early.
Example 1: Now say let’s say I update the date and time to:
Range(“A9”) = 2022-07-21, Thu
Range(“B9”) = 08:01 AM EST
I would like to change the String from:
Range(“C9”) = James turned in assignment in on 2022-07-20, Wed @ 02:09 PM EST – It was early.
To:
Range(“C9”) = James turned in assignment in on 2022-07-21, Thu @ 08:01 AM EST – It was early.
Example 2: Now let’s say I just update the date:
Range(“A9”) = 2022-07-21, Thu
I would like to change the String from:
Range(“C9”) = James turned in assignment in on 2022-07-20, Wed @ 02:09 PM EST – It was early.
To:
Range(“C9”) = James turned in assignment in on 2022-07-21, Thu @ 02:09 PM EST – It was early.
Example 3: Now let’s say I just update the time:
Range(“B9”) = 08:01 AM EST
I would like to change the String from:
Range(“C9”) = James turned in assignment in on 2022-07-20, Wed @ 02:09 PM EST – It was early.
To:
Range(“C9”) = James turned in assignment in on 2022-07-20, Wed @ 08:01 AM EST – It was early.