PDA

View Full Version : [SOLVED] Question about concatenate



lucas
07-09-2004, 12:00 PM
FireFyter posted this code to a previous post:



Dim start As Long, lastRow As Long
start = 4
lastRow = ExcelWS1.Range("A65536").End(xlUp).Row
Do
ExcelWS1.Range("F" & start).Value = _
ExcelWS1.Range("G" & start).Value & ExcelWS1.Range("H" & start).Value & _
ExcelWS1.Range("I" & start).Value & ExcelWS1.Range("J" & start).Value & _
ExcelWS1.Range("K" & start).Value & ExcelWS1.Range("L" & start).Value
start = start + 1
Loop Until start > lastRow


I was wondering how you would put a space or a hyphen between the merged data in column F.

lucas
07-09-2004, 01:43 PM
Sorry to take up space here. I looked at a formula I had for merging data in cells and figured out how to do it in the vba.

this one will put a space



Sub concateColA()
Dim start As Long
Dim lastRow As Long
start = 4
lastRow = [A65536].End(xlUp).Row
Do
Range("F" & start).Value = _
Range("G" & start).Value & " " & Range("H" & start).Value & " " & _
Range("I" & start).Value & " " & Range("J" & start).Value & " " & _
Range("K" & start).Value & " " & Range("L" & start).Value
start = start + 1
Loop Until start > lastRow
End Sub


if you use this code in the line it will put a dash between the merged data:



Range("G" & start).Value & "-" & Range("H" & start).Value & "-" & _

Zack Barresse
07-09-2004, 01:47 PM
:) I was just about to post that until I saw you posted a solution! Got busy for a bit, but glad it was sorted!