I am trying to concatenate the selected range between 2 specific columns. My first column name is "Product-name" (First column is fixed) and second specific column is not fixed. It can be 3rd, 4th, 5th or N. The name of that column is "Price". I want to concatenate all columns that fall between this 2 columns. I tried the following code.
Sub test()
Cells(1, 1).Select
j = 1
Do
k = Cells(1, j).Value
Cells(1, j).Select
j = j + 1
Loop Until (k = "Product-name")
c1 = j
Do
k = Cells(1, j).Value
Cells(1, j).Select
j = j + 1
Loop Until (k = "Price")
c2 = j - 2
If (c2 > c1) Then
'I am doing something wrong here. Please let me know the correct syntax
CONCATENATE(Range(Columns(c1), Columns(c2)))
End If
End Sub