VBA create string array

mahmed1

Well-known Member
Joined
Mar 28, 2009
Messages
2,302
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi Guys

I have 3 columns A2:C10 where i put an Id in ie 12345
now some cells could have blanks, an Id or multiple Ids separated by a comma

what i want to be able to do is if the cell has an id or multiple ids then create a string like this
<found>
for some reason its lost my string concat

it should be like this

(Found)
(ID)123456(/ID)
(/Found)


(Found)
(ID)555555(/ID)
(/Found)


<found><found><found><found><found>If the cell is blank then skip over it and dont process it
If all cells are blank the exit sub saying no data to import

I hope this makes sense

thank
you</found></found></found></found></found></found>
 
Last edited by a moderator:

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Multiple id's separated by a comma, or a comma then space?
Where do you want the stings to go?
And in what format? Is it

(Found)
(ID)123456(/ID)
(/Found)

(Found)
(ID)123457(/ID)
(/Found)

or

(Found)(ID)123456(/ID)(/Found)(Found)(ID)123457(/ID)(/Found)

If there's only 1 id in a cell, is it just

(Found)
(ID)123456(/ID)
(/Found)

or

(Found)(ID)123456(/ID)(/Found)

Are you happy with a VBA solution, or do you want Power Query or formula's?
 
Last edited:
Upvote 0
Hi

I need it in this format and it will need to be VBA

(Found)
(ID)123456(/ID)
(/Found)

(Found)
(ID)123457(/ID)
(/Found)

it should be stored in sheet output cell A1

problem is that it should be seperated by a comma then space but sometimes agents could do it in just comma or comma then space or double space so will need to get values only between the commas
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,179
Members
452,615
Latest member
bogeys2birdies

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