Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

replace a var in an array

Posted on 2004-08-20
3
Medium Priority
?
194 Views
Last Modified: 2010-05-02
im looking to replace a word in a array list of something like "#4,#hello,#yellow,#Den,#Charlie,#wow,#menu"

and replace #4 with #4:20

my array list is housed in arglist(1) allready

how do i do that please

thanks ever so much
0
Comment
Question by:Johnny
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
Colosseo earned 2000 total points
ID: 11856456
Hi Pern

I hope this is what you are after

' value to find
str_Search = "#4"

' value to replace search string with
str_Replace = "#4:20"

' populate array
arglist = Array("#4", "#hello", "#yellow", "#Den", "#Charlie", "#wow", "#menu")

' for each item in the array
For i = LBound(arglist) To UBound(arglist)
  ' if the search string is found then replace it
  If arglist(i) = str_Search Then arglist(i) = str_Replace
Next

Regards

Scott
0
 

Author Comment

by:Johnny
ID: 11856543
one million percent perfect thx  Colosseo

heres your points
0
 
LVL 15

Expert Comment

by:Colosseo
ID: 11856557
Hi Pern

one million percent perfect sounds good too me :)

Glad your happy and thanks for the grade!

Scott
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month10 days, 20 hours left to enroll

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question