1
EDIT: Found the stray code that threw it off. Thanks everyone!
I've been trying to figure out the code to concatenate
Worksheets("Sheet1").Range ("B2:C2")
to this reference cell with " - " character as a separator:
Worksheets("Sheet2").Range ("B2")
I've tried the following, but it says "subscript out of range":
Worksheets("Sheet2").Range("B2").Cell.Value =
Worksheets("Sheet1").Range("B2").Cell.Value &
Worksheets("Sheet1").Range("C2").Cell.Value
I've also tried this, but it only copies Sheet1.C2 to Sheet2.C2:
Set sourceRange = Worksheets("Sheet1").Range("B2:C2")
Set targetRange = Worksheets("Sheet2").Range("B2")
sourceRange.Copy
targetRange.PasteSpecial Paste:=xlPasteValues
Any help on this would be appreciated. Thanks in advance!
I see no difference between what the author tried and your suggestion. I could also be blind. It would make sense, I attempted to ssh into the same host, I was phyiscally at just a little awhile ago. – Ramhound – 2017-03-24T18:32:54.270
1("B2").Cell.Value vs ("B2").Value (no "CELL" in Máté suggestion) – arana – 2017-03-24T18:38:58.100