New to VBA so I'm not sure if this is possible. In a program, I’m trying to
concatenate string variables with comma after each variable, but the number
of occurrences of string variable can be different from time to time. ????
New to VBA so I'm not sure if this is possible. In a program, I’m trying to
concatenate string variables with comma after each variable, but the number
of occurrences of string variable can be different from time to time. ????
This code will check column A,
rows 1 to 25 and make a string
see if this helps...
=================================
Sub StringCreat()
Dim rw As Long, str As String
For rw = 1 To 25
If Len(Cells(rw, 1)) > 0 Then
If Len(str) > 0 Then
str = str & ", " & Cells(rw, 1).Text
Else
str = Cells(rw, 1).Text
End If
End If
Next
MsgBox str
End Sub
====================================
--
steveB
Remove "AYN" from email to respond
"DorisM" <DorisM@discussions.microsoft.com> wrote in message
news:04246176-0582-4A95-BCCC-5BF77982B634@microsoft.com...
> New to VBA so I'm not sure if this is possible. In a program, I'm trying
> to
> concatenate string variables with comma after each variable, but the
> number
> of occurrences of string variable can be different from time to time.
> ????
Hi Steve;
Thank you for your help. I modify the code to what I needed to do in my
program and it works.
DorisM
"STEVE BELL" wrote:
> This code will check column A,
> rows 1 to 25 and make a string
> see if this helps...
>
> =================================
> Sub StringCreat()
> Dim rw As Long, str As String
>
> For rw = 1 To 25
> If Len(Cells(rw, 1)) > 0 Then
> If Len(str) > 0 Then
> str = str & ", " & Cells(rw, 1).Text
> Else
> str = Cells(rw, 1).Text
> End If
> End If
> Next
> MsgBox str
> End Sub
> ====================================
>
> --
> steveB
>
> Remove "AYN" from email to respond
> "DorisM" <DorisM@discussions.microsoft.com> wrote in message
> news:04246176-0582-4A95-BCCC-5BF77982B634@microsoft.com...
> > New to VBA so I'm not sure if this is possible. In a program, I'm trying
> > to
> > concatenate string variables with comma after each variable, but the
> > number
> > of occurrences of string variable can be different from time to time.
> > ????
>
>
>
Doris,
Am happy to hear that you got it to work! You are very Welcome!
keep on Exceling...
--
steveB
Remove "AYN" from email to respond
"DorisM" <DorisM@discussions.microsoft.com> wrote in message
news:7174FCCB-9A22-46EA-917D-D94447950E9C@microsoft.com...
> Hi Steve;
>
> Thank you for your help. I modify the code to what I needed to do in my
> program and it works.
>
> DorisM
>
> "STEVE BELL" wrote:
>
>> This code will check column A,
>> rows 1 to 25 and make a string
>> see if this helps...
>>
>> =================================
>> Sub StringCreat()
>> Dim rw As Long, str As String
>>
>> For rw = 1 To 25
>> If Len(Cells(rw, 1)) > 0 Then
>> If Len(str) > 0 Then
>> str = str & ", " & Cells(rw, 1).Text
>> Else
>> str = Cells(rw, 1).Text
>> End If
>> End If
>> Next
>> MsgBox str
>> End Sub
>> ====================================
>>
>> --
>> steveB
>>
>> Remove "AYN" from email to respond
>> "DorisM" <DorisM@discussions.microsoft.com> wrote in message
>> news:04246176-0582-4A95-BCCC-5BF77982B634@microsoft.com...
>> > New to VBA so I'm not sure if this is possible. In a program, I'm
>> > trying
>> > to
>> > concatenate string variables with comma after each variable, but the
>> > number
>> > of occurrences of string variable can be different from time to time.
>> > ????
>>
>>
>>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks