Need help in Macro where two dates in a cell can be shown in different cell

Vijaya Kanthi

New Member
Joined
Jul 27, 2018
Messages
14
Need help in creating a MACRO for separating 2 dates in a cell and show in different cell and the format of the date should be YYYYMMDD

example: [TABLE="width: 833"]
<colgroup><col width="1110" style="width: 833pt; mso-width-source: userset; mso-width-alt: 40594;"> <tbody>[TR]
[TD="width: 1110, bgcolor: transparent"]If A1 = The Flow (15/09/2009 00:00) is prior (01/09/2013 00:00).

In B1 ( I want)
20090915

In C1 ( I want )
2010901

A1 data should not change

can any one help in this????

Regards
K

[/TD]
[/TR]
</tbody>[/TABLE]
 
Hello,

sorry for the delay

1. In Column G there are 5000 lines ( with different information)
2. In there is no Date in Column G then Column H & I can be empty
3. If there is Date in Column G then it populate column H & I accordingly

kindly advice

Regards,
K
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Try this:-
Code:
[COLOR="Navy"]Sub[/COLOR] MG01Aug11
[COLOR="Navy"]Dim[/COLOR] Sp [COLOR="Navy"]As[/COLOR] Variant
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range
[COLOR="Navy"]Set[/COLOR] Rng = Range("G1", Range("G" & Rows.Count).End(xlUp))
[COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
Sp = Split(Dn.Value, "(")
[COLOR="Navy"]If[/COLOR] UBound(Sp) > 0 [COLOR="Navy"]Then[/COLOR]
    [COLOR="Navy"]On[/COLOR] [COLOR="Navy"]Error[/COLOR] [COLOR="Navy"]Resume[/COLOR] [COLOR="Navy"]Next[/COLOR]
        [COLOR="Navy"]If[/COLOR] IsDate(Split(Sp(1), ")")(0)) [COLOR="Navy"]Then[/COLOR]
            Dn.Offset(, 1).Value = Format(Split(Sp(1), ")")(0), "YYYYMMDD")
        [COLOR="Navy"]End[/COLOR] If
        [COLOR="Navy"]If[/COLOR] IsDate(Split(Sp(2), ")")(0)) [COLOR="Navy"]Then[/COLOR]
            Dn.Offset(, 2).Value = Format(Split(Sp(2), ")")(0), "YYYYMMDD")
        [COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]End[/COLOR] If
[COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0
Can you not use simple excel?
FORMAT MID Find"(" , YYYYMMDD
FORMAT MID Find"(",starting from first "(", even use substitute to replace second ( with something....

Cancat result
 
Upvote 0
hello niki...

I tried that but the information what I am looking for is not the output... sorry....

anyways thanks for he advice

Regard,
K
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,930
Members
452,367
Latest member
TePunaBloke

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
Back
Top