J
jessiright77
Hello.
I have a spreadsheet that contains many records... one record per row.
When I place my cursor in one of the rows, I can invoke a macro that
prints a barcode sheet for the ONE record in that row.
However... now I need to print a barcode sheet for ALL of the records
(and there are hundreds of them). Is there any way to modify the
following macro so that it will print a barcode sheet for ALL of the
records in one batch (instead of my having to manually run the macro
for each row)?
Any help would be greatly appreciated! Thanks,
Jessi
THE MACRO:
Sub PrintBarcode()
'Dimension the variables:
Dim iOffsetValue As Integer
'Get the row number and save to the iOffsetValue variable (you must
subtract one to account for the header row):
iOffsetValue = ActiveWindow.ActiveCell.Row - 1
'Make the barcode sheet visible:
Sheets("BarcodeSheet").Visible = True
'Select the barcode sheet:
Sheets("BarcodeSheet").Select
'Select the offset adjustment cell:
Range("M2").Select
'Place the offset value:
ActiveCell.FormulaR1C1 = iOffsetValue
'Print and hide the barcode sheet:
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("BarcodeSheet").Visible = False
'ActiveWindow.SelectedSheets.Visible = False
End Sub
I have a spreadsheet that contains many records... one record per row.
When I place my cursor in one of the rows, I can invoke a macro that
prints a barcode sheet for the ONE record in that row.
However... now I need to print a barcode sheet for ALL of the records
(and there are hundreds of them). Is there any way to modify the
following macro so that it will print a barcode sheet for ALL of the
records in one batch (instead of my having to manually run the macro
for each row)?
Any help would be greatly appreciated! Thanks,
Jessi
THE MACRO:
Sub PrintBarcode()
'Dimension the variables:
Dim iOffsetValue As Integer
'Get the row number and save to the iOffsetValue variable (you must
subtract one to account for the header row):
iOffsetValue = ActiveWindow.ActiveCell.Row - 1
'Make the barcode sheet visible:
Sheets("BarcodeSheet").Visible = True
'Select the barcode sheet:
Sheets("BarcodeSheet").Select
'Select the offset adjustment cell:
Range("M2").Select
'Place the offset value:
ActiveCell.FormulaR1C1 = iOffsetValue
'Print and hide the barcode sheet:
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
Sheets("BarcodeSheet").Visible = False
'ActiveWindow.SelectedSheets.Visible = False
End Sub