Need some help squaring away this code. I am trying to create an xlsm that copies data into adjacent columns and then formats it into scan-able bar code font. The code I have is a conglomeration of my novice skills and lots of google searching as well as help from previous projects. Here is what I have:
Code
Sub ClearPage()
' Clears Sheet For New Input
Cells.Delete
'Set Row 1 @ 50 Points & Freeze
Rows("1:1").RowHeight = 50
With Act iveWindow
.SplitColumn = 0
.SplitRow = 1
End With
ActiveWindow.FreezePanes = True
End Sub
Sub ConvertFont()
'Copy Data from Colums A & B to D & F respectively
'Convert Font in Cloumns E & G to 3 of 9 BarCode
'Insert Asterisk Before and after Cell Value
Dim lr As Long
Dim rng1, rng2, rng3, rng4, rng5, rng6 As Range
Set rng1 = ("A2:A" & lr) ' this is where I get error
Set rng2 = ("B2:B" & lr)
Set rng3 = ("D2:D" & lr)
Set rng4 = ("F2:F" & lr)
Set rng5 = ("E2:E" & lr)
Set rng6 = ("G2:G" & lr)
'Perform Copy/Paste Operation
'From https://www.excelcampus.com/vba/copy-paste-cells-vba-macros/
rng3.Value = rng1.Value
rng4.Value = rng2.Value
'Insert Asterisks
If rng3.Value <> "" Then rng3.Value = "*" & rng3.Value
End If
If rng4.Value <> "" Then rng4.Value = rng4.Value & "*"
End If
'Perform 2nd Copy/Paste Operation after Asterisk addition
rng5.Value = rng3.Value
rng6.Value = rng4.Value
'Change Font of E & G to 3of9; Font Size to 36; Column Width to 36
Range("rng5, rng6").Select
With Selection.Font
.Name = "3 of 9 Barcode"
.FontStyle = "Regular"
.Size = 36
.ColumnWidth = 36
End With
'Center Align Entire WorkSheet
With ActiveWindow
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
End With
End Sub
Display More
Please see attachments as visual aid forum.ozgrid.com/index.php?attachment/70159/forum.ozgrid.com/index.php?attachment/70160/
Any assistance will be greatly appreciated.
I do have another post for this on ExcelGuru
http://%22http//www.excelguru…e-Embed-Font%22