Finding text reference in a cell and obtaining 13 characters after this same reference.

Noodles90

New Member
Joined
Sep 14, 2021
Messages
9
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
Hello,
I have previously made a post which in which my question was not very well formulated.
In fact, the problem I have is much simpler.
How to write a vba command to return in a target cell, the subsequent 15 digits in text after a keyword is found in the text contained in a specific single cell?

Example​
Result for "Intref" word:​
Some text here written Intref: 05897423654422; v 541 n Some more text for the example​
05897423654422​

I have searched, but I am not being able to make it work correctly.
With formulas this is relatively easy to do, but for this particular application I needed it in vba.
Can anyone advise?
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
For Example. You can use a loop for multiple cells.

VBA Code:
Sub jvr()
 With Cells(1, 5)
   .NumberFormat = "@"
   .Value = Left(Split(Cells(1, 1), "Intref: ")(1), 14)
 End With
End Sub
 
Upvote 0
Solution
For Example. You can use a loop for multiple cells.

VBA Code:
Sub jvr()
 With Cells(1, 5)
   .NumberFormat = "@"
   .Value = Left(Split(Cells(1, 1), "Intref: ")(1), 14)
 End With
End Sub
@JEC Thanks a lot, it was exactly this I was searching for! :)
 
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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