Reputation: 187
I am trying to merge two cells into one multiline cell. The first cell consists of an address, the second cell holds a number that gets converted into a barcode by using a special font.
The content of the second cell should keep the font that is assigned to it(barcode font), after merging it with the first cell.
Can anyone point me in the right direction?
UPDATE:
Here is my working solution
Sub barcode()
Dim i As Integer
With Worksheets("sheet4")
For i = 2 To 19539
With .Cells(i, "J")
.Value = .Offset(0, -2).Value2 & Chr(10) & .Offset(0, -1).Value2
.Characters(Start:=Len(.Offset(0, -2).Value2) + 2, _
Length:=Len(.Offset(0, -1).Value2)).Font.Name = .Offset(0, -1).Font.Name
End With
Next i
End With
End Sub
Upvotes: 0
Views: 68
Reputation:
Manipulate the .Characters property.
With Worksheets("sheet4")
With .Cells(6, "F")
.Value = .Offset(0, -2).Value2 & Chr(10) & .Offset(0, -1).Value2
.Characters(Start:=Len(.Offset(0, -2).Value2) + 1, _
Length:=Len(.Offset(0, -1).Value2)).Font.Name = .Offset(0, -1).Font.Name
End With
End With
Upvotes: 1