Combining cell entries to one cell with code
Sub names()
Dim i As Integer
Dim s As String
With Range("a1")
Do Until IsEmpty(.Offset(i, 0))
s = s & .Offset(i, 0).Value & ","
i = i + 1
Loop
End With
s = Left(s, Len(s) - 1)
Range("b1").Value = s
End Sub
"jnf40" wrote:
I have 8 cells in a range what I want to do is loop through these cells and
if they have a name in them put them in the same cell seperated with a comma
and a space, such as
if A1:A8 = my range then I want to see if any of these cells have a name in
them and if so I would get
A1 = John
A2 = Bob
A3 = Harry
B1 = John, Bob, Harry and so on
can this be done?
|