(Solved) – How to Loop through the range and assign value to parameter


I am facing an issue regarding Excel VBA code and hoping that anyone can help me on this.

I have an Excel column which is Range B2 until the last row of column B as below:

|Column B Header|
|apple          |
|orange         |
|strawberry     |
|blueberry      |

I want to assign all the value in cell B into a parameter with some additional text.

For example :

fruits = appleorangestrawberryblueberry

This is my code so far, I have difficulty to make each value to continue at behind after each cell read.

Dim c As Range
For each c In Range("B2:B" & lastrow)
   fruits = "" & c.Value & ""
Next c

I really appreciate it if anyone willing to help me on this.

Leave a Reply

Your email address will not be published. Required fields are marked *