Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Building A string
I have a need to build a string that is a concantanation of and undetermined
amonunt of addresses. For example my code finds an initial address of a cell and stores it to a variable. my code then performs a find next to get the next address and i would like to build on to the initial string for every new address with a desired final string something similar to this "=$a$13 & "+" & $a$23 & "+" & $a$613 & "+" & $c$733 ... basically im trying to build a string to put in a cell that will add the values of certain cells based on a condition your help is greatly appreciated |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Building A string
The below macro will take you in the right direction..
Sub Macro1() Dim varFound As Variant, varSearch As Variant Dim strAddress As String, strOutput As String varSearch = "dmoney" With Worksheets("Sheet1").UsedRange Set varFound = .Find(varSearch, LookIn:=xlValues) If Not varFound Is Nothing Then strAddress = varFound.Address Do Set varFound = .FindNext(varFound) strOutput = strOutput & "+" & varFound.Address Loop While Not varFound Is Nothing And _ varFound.Address < strAddress End If End With MsgBox "=" & Mid(strOutput, 2) End Sub If this post helps click Yes --------------- Jacob Skaria "dmoney" wrote: I have a need to build a string that is a concantanation of and undetermined amonunt of addresses. For example my code finds an initial address of a cell and stores it to a variable. my code then performs a find next to get the next address and i would like to build on to the initial string for every new address with a desired final string something similar to this "=$a$13 & "+" & $a$23 & "+" & $a$613 & "+" & $c$733 ... basically im trying to build a string to put in a cell that will add the values of certain cells based on a condition your help is greatly appreciated |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Building SQL-string with vba | Excel Programming | |||
String Building for Where Clause in query | Excel Programming | |||
String Building for Where Clause in Query | Excel Programming | |||
Building a string | Excel Programming | |||
Building Sum by Matching String | Excel Discussion (Misc queries) |