Repeat Word in cell and split font style

Kinngs

New Member
Joined
Oct 4, 2011
Messages
22
Hi,
I've a code (e.g. BPLIK00049) in cell range A:A

i need this code to be repeated twice in coloumn B:B for barcode printing purpose.
also i need the cell to be split in two different font style
1st in calibri 22 bold
2nd in "Free 3 0f 9" size 22 bold
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hi and welcome to the Board
Are the codes (BPLIK00049) all the same length, eg, 10 characters ?
 
Upvote 0
First up, I dont have the second font, so you will have to modify the line to suit.
Give this a try
Rich (BB code):
Sub modify()
Dim lr As Long, r As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
For r = lr To 1 Step -1
    Range("B" & r).Value = Range("A" & r) & " " & Range("A" & r)
    Range("B" & r).Copy
    Range("B" & r).PasteSpecial Paste:=xlPasteValues
    Application.CutCopyMode = False
    With Range("B" & r).Characters(Start:=1, Length:=10).Font
        .Name = "Calibri"
        .FontStyle = "Bold"
        .Size = 22
    End With
    With Range("B" & r).Characters(Start:=12, Length:=10).Font
        .Name = "Freestyle Script"  'change this line to the correct font name
        .FontStyle = "Bold"
        .Size = 22
    End With
Next r
End Sub
 
Upvote 0
Hey Mike.. Supa thanks it worked perfect...
can i split the codes with alt & enter instead of a space.... pls

Thanks & Regards
 
Upvote 0
Try
Code:
Sub modify()
Dim lr As Long, r As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
For r = lr To 1 Step -1
    Range("B" & r).Value = Range("A" & r) & vbCrLf & Range("A" & r)
    Range("B" & r).Copy
    Range("B" & r).PasteSpecial Paste:=xlPasteValues
    Application.CutCopyMode = False
    With Range("B" & r).Characters(Start:=1, Length:=10).Font
        .Name = "Calibri"
        .FontStyle = "Bold"
        .Size = 22
    End With
    With Range("B" & r).Characters(Start:=13, Length:=10).Font
        .Name = "Freestyle Script"
        .FontStyle = "Bold"
        .Size = 22
    End With
Next r
Columns("B:B").ColumnWidth = 22
Rows("1:" & lr).RowHeight = 53
End Sub
 
Last edited:
Upvote 0
Another version with the redundant code removed....no need for copy / paste
Code:
Sub modify()
Dim lr As Long, r As Long
lr = Cells(Rows.Count, "A").End(xlUp).Row
For r = lr To 1 Step -1
    Range("B" & r).Value = Range("A" & r) & vbCrLf & Range("A" & r)
    With Range("B" & r).Characters(Start:=1, Length:=10).Font
        .Name = "Calibri"
        .FontStyle = "Bold"
        .Size = 22
    End With
    With Range("B" & r).Characters(Start:=13, Length:=10).Font
        .Name = "Freestyle Script"
        .FontStyle = "Bold"
        .Size = 22
    End With
Next r
Columns("B:B").ColumnWidth = 22
Rows("1:" & lr).RowHeight = 53
End Sub
 
Upvote 0
No worries
Thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,224,613
Messages
6,179,903
Members
452,948
Latest member
Dupuhini

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top