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!
You've extra cell
s
Worksheets("Sheet2").Range("B2").Value = Worksheets("Sheet1").Range("B2").Value & Worksheets("Sheet1").Range("C2").Value
Should work.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments