vba code require to separate date from code

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,232
Hi All,

I need a vba code, where I can split range value in code and date.

This are the values in Col A.
CGU 002 - 05/89
ECG 21 501 - 05/00
ECG 21 762 - 04/14
CG 21 73 - 01/00
CG 21 06 - 05/14
CG 21 35 - 10/01
CG 21 47 - 12/07
CG 21 54 - 01/96
CG 21 55 - 09/99
CG 21 86 - 12/04
CG 21 96 - 03/05
CG 22 34 - 04/13
CG 22 43 - 04/13
CGU 002 - 05/89
ECG 21 501 - 05/00

<colgroup><col></colgroup><tbody>
</tbody>

<colgroup><col></colgroup><tbody>
</tbody>

Here, "05/89" these are dates. I want, "CGU 002" these in A range and "05/89" these in B Col with addition of "05/01/89"..

Can some one pls help..
 
Hi Rick Sir..
With this I have one query...one date format is not coming in proper output..

Could you please, tell me the reason it is not capturing with our code..
dates are..
UTS-COVPG 7-03
IL 00 17 02/2013

for these, output coming like these..

Form number Date
UTS-COVPG 7-03 12/3/1901
IL 00 17 02 20/01/13

which incorrect...can you guide..


Give this revised macro a try (note I revised the comments for the changed parts of the code as was needed)...
 
Upvote 0

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Hi Rick Sir..
With this I have one query...one date format is not coming in proper output..

Could you please, tell me the reason it is not capturing with our code..
dates are..

for these, output coming like these..

Form number Date
UTS-COVPG 7-03 12/3/1901
IL 00 17 02 20/01/13

which incorrect...can you guide..
The reason my code doesn't work for those is because they do not follow the format you told us all of your numbers follow. In Message #9 , you told us this...

"In all the pattern, last 04 digit's are my date. (MM/YY format.)

That first example only has 3 numbers in it while the second example appears to have 17 as its month number. I can probably rewrite my code (and it will take an actual rewrite) to handle the first example, but I am not sure on that second example whether the answer is the 02 is the month and 17 is the year OR whether I am supposed to use the last three digits (7 02) only because the last four digits cannot be made into an actual mm/dd date.
 
Last edited:
Upvote 0
Thank You so much for your reply sir...

I agree totally that we made the code like MM/YY last 4 digit basis...

Now things like, this is newest format appear in data...and not working..again question on automation..and hence i again put this to get some solution, sir..

only these 3 if have I left, everything super - super working..
I,e,
UTS-COVPG 7-03....here form number and date producing wrong

IL 00 17 02/2013.....here too, form number and date producing wrong

CA2OOOI (03/10).....and here, form number producing incorrect but date perfect



The reason my code doesn't work for those is because they do not follow the format you told us all of your numbers follow. In Message #9 , you told us this...

"In all the pattern, last 04 digit's are my date. (MM/YY format.)

That first example only has 3 numbers in it while the second example appears to have 17 as its month number. I can probably rewrite my code (and it will take an actual rewrite) to handle the first example, but I am not sure on that second example whether the answer is the 02 is the month and 17 is the year OR whether I am supposed to use the last three digits (7 02) only because the last four digits cannot be made into an actual mm/dd date.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,959
Members
449,096
Latest member
Anshu121

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