Setting varible to equal values of a # of cells

  • Thread starter Thread starter mozart
  • Start date Start date
M

mozart

Is there a way of grabbing the values of a range of cells and assignin
them to a string vairable.

For example if I had RED, BLUE, WHITE in cells A1 to A3 respectively
how could I get my variable strColors=RedBlueWhite

I have tried strColors=Range("A1:A3").value and that obviously did no
work.

Assistance Appreciated
 
Hi Mozart,

I hope this will be music to you ...

Sub RWB()
Dim RWB As String
RWB = Range("A1").Value & Range("A2").Value & Range("A3").Value
End Sub

HTH
Cheers
Carim
 
Hi Mozart,

I hope this will be music to you ...


Sub RWB()
Dim RWB As String
RWB = Range("A1").Value & Range("A2").Value & Range("A3").Value
End Sub


HTH
Cheers
Carim
 
Yes that would seem the way to do it but it could become painful if say
your range was say 50 cells let alone 62k.

Thanks
 
Sub RWB()
Dim RWB As String
Dim i As Integer
For i = 1 To 50
RWB = RWB & Range("A" & i).Value
Next i
End Sub

All the Best
Carim
 
Would this work for you using the later versions of Excel.
This demo starts at Cell A1 for a size of 50.

Sub Demo()
Dim Str As String
Dim n As Long

n = 50
Str = Join(WorksheetFunction.Transpose(Range("A1").Resize(n)),
vbNullString)
End Sub
 
Back
Top