Need Help Making a Macro Repeat Until All Rows Are Processed
Thanks for your help, John, but when I modified and ran the macro,
however, I got the following error mesage:
"Run-time Error '1004': Application-defined or object-defined error."
I have reinserted the modified code. Did I do it wrong?
Thanks,
Jessi
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
Do Until Cells(iOffsetValue, 1) = "" 'place this after you make the
sheet visible unless there are multiple sheets
'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
'Increment iOffsetValue:
iOffsetValue = iOffsetValue + 1
Loop
Sheets("BarcodeSheet").Visible = False
'ActiveWindow.SelectedSheets.Visible = False
End Sub
|