Need to translate into VBA

insanity

New Member
Joined
Feb 1, 2007
Messages
19
Is there a way to translate the following cells and their formulas into VBA code? What I am trying to do is take the Julian date(the first 7 is the year and 037 the day) and time "7037/2310" and translate it into "06/2310", which would be the 6th of Feb at 23:10. Thanks for any help you can give.

Julian Date/Time in cell E2 "7037/2310"

Cell F2 "7037" (with formula) =LEFT(E2,4)

Cell G2 contains "2/6/2007" (with formula) =DATE(IF(0+(LEFT(F2,1))<30,2000,1900)+LEFT(F2,1),1,RIGHT(F2,3))

Cell H2 "06" (formula) =DAY(G2)

Cell I2 "2310" (formula) =RIGHT(E2,4)

Cell J2 "6/2310" =CONCATENATE($H2,"/",$I2)
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,358
Office Version
  1. 365
Platform
  1. Windows
Translate in what way?
Code:
x = Split(Range("E2"), "/")

MyDateTime = DateSerial(Left(x(0), 1), 0, Mid(x(0), 2)) + TimeSerial(Left(x(1), 2), Mid(x(1), 3), 0)

MsgBox MyDateTime
 
Upvote 0

Forum statistics

Threads
1,186,827
Messages
5,960,026
Members
438,458
Latest member
manojkumarat1999

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top