Extract date from text by code VBA

sofas

Active Member
Joined
Sep 11, 2022
Messages
468
Office Version
  1. 2019
Platform
  1. Windows
hello .I have this text in the column A how can i extract 05/12/2022 from within the text in column b
along the column

total selext frome 05/12/2022 to 06/12/2022

Screenshot 2022-12-27 200153.png
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Use this formula:

Dante Amor
AB
1
2total selext frome 05/12/2022 to 06/12/202205/12/2022
3total selext frome 04/12/2022 to 10/12/202204/12/2022
Hoja2
Cell Formulas
RangeFormula
B2:B3B2=MID(A2,SEARCH("??/??/????",A2),10)+0
 
Upvote 0
Solution
Can I convert it into code vba?

Your data starts in cell A2 going down, the results will be in cell B2 going down.

VBA Code:
Sub Macro8()
  With Range("B2:B" & Range("A" & Rows.Count).End(3).Row)
    .Formula = "=MID(A2,SEARCH(""??/??/????"",A2),10)+0"
    .Value = .Value
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,570
Messages
6,120,294
Members
448,953
Latest member
Dutchie_1

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