Auto numbering when printing based on cell value

starfox142

New Member
Joined
Aug 3, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi there,

Attached is a pallet label example our warehouse are using and they would like to know if there is a way to auto fill the pallet number based on the total pallet value.

EG

Total number of pallets is 10 so they would manually fill this in on the label (yellow cell on the right) and when they go to print it would print 1 of 10, 2 of 10, 3 of 10 etc
 

Attachments

  • Pallet Label.GIF
    Pallet Label.GIF
    90.6 KB · Views: 16

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
no tested, just write down:

VBA Code:
Sub printpalletheaders()
For i = 1 To Sheet("PalletHeader").Range("B1").Value                      ' B1 as example, that address of RIGHT yellow cell
    Sheet("PalletHeader").Range("A1").Value = i     ' A1 as example, that address of LEFT yellow cell
    Sheet("PalletHeader").PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False, preview:=False
Next i
End Sub
 
Upvote 0
Thank you for getting back to me, I got the attached error.

Pallet label1.xlsx
ABCDEFGHI
1Company
2
3
4
5CustomerCustomer
6
7
8DestinationMiddlesbrough
9
10
11Delivery DaySaturday
12
13
14Delivery Date30/07/2021
15
16
17Ship ViaTransport company
18
19
20WindowTemp
21
22
23Products7Qty7
24
25
26Pallet Noof7
27
28
29SSCC Code
30
31
Sheet1
Cells with Data Validation
CellAllowCriteria
E11:I13List=Sheet2!$B:$B
E5:I7List=Sheet2!$A:$A
E17:I19List=Sheet2!$C:$C
 

Attachments

  • VBA Error.GIF
    VBA Error.GIF
    26 KB · Views: 13
Upvote 0
Sheets not sheet. As I said I've written down straight into browser and missed s 3 times.

VBA Code:
Sub printpalletheaders()
For i = 1 To Sheets("PalletHeader").Range("H26").Value
    Sheets("PalletHeader").Range("E26").Value = i
    Sheets("PalletHeader").PrintOut Copies:=1, Collate:=True, IgnorePrintAreas:=False, preview:=False
Next i
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top