View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
John Pierce John Pierce is offline
external usenet poster
 
Posts: 93
Default Concatenating Loop

I need to make the following code work for a variable number of rows
and stop when it reaches a #VALUE! error.


Public Sub ConcatenateEmail()
Dim myString As String
Dim r As Long

myString = ""

For r = 4 To 585
myString = myString & Cells(r, "G") & ","
Next r

myString = Left(myString, Len(myString) - 1)
Range("A2") = myString
End Sub