Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba 打印条形码单元格,但也打印相邻单元格_Vba_Excel_Printing - Fatal编程技术网

Vba 打印条形码单元格,但也打印相邻单元格

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

我在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.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中使用宏