Vba 打印条形码单元格,但也打印相邻单元格
我在Excel 2013中有一个宏,如下所示:Vba 打印条形码单元格,但也打印相邻单元格,vba,excel,printing,Vba,Excel,Printing,我在Excel 2013中有一个宏,如下所示: Sub PrntCells() Dim rng As Range, rngArea As Range, strCell As String Set rng = Selection With ActiveSheet.PageSetup .Zoom = False .FitToPagesWide = 1 .FitToPagesTall = 1 .LeftMargin = Application.InchesToPoi
Sub PrntCells()
Dim rng As Range, rngArea As Range, strCell As String
Set rng = Selection
With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.LeftMargin = Application.InchesToPoints(0)
.RightMargin = Application.InchesToPoints(0)
.TopMargin = Application.InchesToPoints(0)
.BottomMargin = Application.InchesToPoints(0)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.CenterHorizontally = True
.CenterVertically = True
.Orientation = xlPortrait
.LeftHeader = ""
.LeftFooter = ""
End With
'Copy each selection
For Each rngArea In rng.Areas
For Each cell In rngArea
cell.PrintOut Copies:=1
cell.Offset(0, 1).PrintOut Copies:=1
Next cell
Next rngArea
Application.DisplayAlerts = True
rng.Parent.Activate
End Sub
我正在使用加载项为我生成实际的Code128条形码,它工作正常,如下所示:
我有它的设置,因此用户可以选择一系列代码并运行宏,每个条形码都在条形码打印机的标签上显示,但他们也希望将条形码和条形码右侧的单元格显示在标签上,这是项目描述
有没有办法做到这一点?我很难让它打印1标签上的两个单元格
我非常感谢任何帮助,我不是Excel专家,这是我第一次尝试在Excel中使用宏