Solved

replace a var in an array

Posted on 2004-08-20
3
184 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now