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

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,329
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,323
Messages
5,769,454
Members
425,549
Latest member
Bartekelese

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