Copy Part Cell Value to Memory

Gbenga

New Member
Joined
Jun 20, 2023
Messages
3
Office Version
  1. 365
Hi.
I extract a part of the value in a cell in column A to another cell in column B. But I also need to keep the extracted value in memory for use in another application. How do I I do this each time I enter values into any cell in column A?
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Welcome to the MrExcel forum. Please accept my warmest greetings and sincere hope that all is well.

The following is an example of what you need to put a text in memory

VBA Code:
sub test()
  Dim MyData As New DataObject
  
  MyData.SetText Range("A1").text, 1
  MyData.PutInClipboard
end sub

You do not explain in detail which cell, or which part of the cell, but with the previous example I hope you can find the solution.
;)

Or with that data you can search in this forum or on the net, for example:


Regards
Dante Amor
 
Upvote 0
Thanks for your response, DanteAmor.
I have set B cells to =MID(A1,SEARCH("[",A1)+1, SEARCH("]",A1)-SEARCH("[",A1)-1) to extract everything within square brackets in any cell in A column, and the B cells have their data once an A cell is updated. What I am trying to avoid is having to manually copy B cell value into memory. I use the extracted value to search another application. When A2 is updated, I want to use the new extracted value for another search, etc.
 
Upvote 0
Excel Formula:
=MID(A1,SEARCH("[",A1)+1, SEARCH("]",A1)-SEARCH("[",A1)-1)
Not related to your question, but you could try this instead of the above if you have the new functions available.
Excel Formula:
=TEXTAFTER(TEXTBEFORE(A1,"]"),"[")
 
Upvote 0
Welcome to the MrExcel forum. Please accept my warmest greetings and sincere hope that all is well.

The following is an example of what you need to put a text in memory

VBA Code:
sub test()
  Dim MyData As New DataObject
 
  MyData.SetText Range("A1").text, 1
  MyData.PutInClipboard
end sub

You do not explain in detail which cell, or which part of the cell, but with the previous example I hope you can find the solution.
;)

Or with that data you can search in this forum or on the net, for example:


Regards
Dante Amor
Thanks again, Dante.
Kindly explain how to copy the text within brackets in a cell in A Column (or any column really, as long as it applies to all cells in the column) to memory so that I can use this text in another application. Like if I enter WERFHTOY SSDGERT [3456YTEJ00] into a cell, I want to use 3456YTEJ00 in another application. In Access, I would have used the AfterUpdate or similar event to capture do the job. But in Excel, am at a loss.
Secondly, you referred to a previous example which I know nothing about.
 
Upvote 0

Forum statistics

Threads
1,221,448
Messages
6,159,922
Members
451,604
Latest member
SWahl

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