# Macro help!



## Nicko87 (Jan 5, 2023)

Hi all, 

I am after a macro to enable me to print and reprint one worksheet but have 1 cell change before each print based on a list of values. 

the list ranges from A1:A1428 on a separate tab. 

the cell i want to amend each time is in the tab "master sheet" and is cell "B1"


can anyone help?


----------



## HaHoBe (Jan 5, 2023)

Hi Nicko87,

I doubt I would that amount of pages...


```
Public Sub MrE_1226092_1700518()
' https://www.mrexcel.com/board/threads/macro-help.1226092/

Dim wsPrint As Worksheet
Dim wsData As Worksheet
Dim rngList As Range
Dim rngCell As Range

'at present print is limited to the first 25 rows
'change value to True to go for the whole range
Const cblnLive As Boolean = False

'change sheetnames to suit
Set wsPrint = Worksheets("master sheet")
Set wsData = Worksheets("DataList")

If cblnLive Then
  Set rngList = wsData.Range("A1:A1428")
Else
  Set rngList = wsData.Range("A1:A25")
End If

For Each rngCell In rngList
  If Trim(rngCell.Value) <> vbNullString Then
    wsPrint.Range("B1").Value = rngCell.Value
    wsPrint.PrintOut
  End If
Next rngCell

Set rngList = Nothing
Set wsData = Nothing
Set wsPrint = Nothing
End Sub
```

Ciao,
Holger


----------



## Nicko87 (Jan 5, 2023)

LocationA-001-ACounter's Name….....................Writer's Name…..............................DATE…...............LINE NoPART NUMBERDESCRIPTIONSHELF NoQTYEA/MTAUDIT QTYAUDIT SIGNINPUT ü1234567891011121314151617181920


----------



## Nicko87 (Jan 5, 2023)

above is the sheet, i wish to print but before each print, i need cell B1 (A-001-A) to change to the below the next one in the list, thank you so much


A-001-AA-001-BA-001-CA-001-DA-002-AA-002-BA-002-CA-002-DA-003-AA-003-BA-003-CA-004-AA-004-BA-004-CA-005-AA-005-BA-005-CA-006-AA-006-BA-006-CA-007-AA-007-BA-007-CA-008-AA-008-BA-008-CA-009-AA-009-BA-009-CA-010-AA-010-BA-010-CA-010-DA-011-AA-011-BA-011-CA-011-DA-012-AA-012-BA-012-CA-012-DA-013-AA-013-BA-013-CA-014-AA-014-BA-014-CA-015-AA-015-BA-015-CA-016-AA-016-BA-016-CA-017-AA-017-BA-017-CA-018-AA-018-BA-018-CA-019-AA-019-BA-019-CA-020-AA-020-BA-020-CA-021-AA-021-BA-021-CB-001-AB-001-BB-001-CB-001-DB-002-AB-002-BB-002-CB-002-DB-003-AB-003-AB-003-BB-003-CB-003-DB-004-AB-004-BB-004-CB-004-DB-005-AB-005-BB-005-CB-005-DB-006-AB-006-BB-006-CB-006-DB-007-AB-007-BB-007-CB-008-AB-008-BB-008-CB-009-AB-009-BB-009-CB-010-AB-010-BB-010-CB-011-AB-011-BB-011-CB-012-AB-012-BB-012-CB-013-AB-013-BB-013-CB-014-AB-014-BB-014-CB-015-AB-015-BB-015-CB-016-AB-016-BB-016-CB-017-AB-017-BB-017-CB-018-AB-018-BB-018-CB-019-AB-019-BB-019-CB-020-AB-020-BB-020-CB-021-AB-021-BB-021-CB-022-AB-022-BB-022-CB-023-AB-023-BB-023-CB-024-AB-024-BB-024-CB-025-AB-025-BB-025-CB-026-AB-026-BB-026-CB-027-AB-027-BB-027-CB-028-AB-028-BB-028-CB-029-AB-029-BB-029-CB-030-AB-030-BB-030-CC-001-AC-001-BC-001-CC-001-DC-002-AC-002-BC-002-CC-002-DC-003-AC-003-BC-003-CC-003-DC-004-AC-004-BC-004-CC-005-AC-005-BC-005-CC-006-AC-006-BC-006-CC-007-AC-007-BC-007-CC-008-AC-008-BC-008-CC-009-BC-009-CC-010-AC-010-BC-010-CC-011-AC-011-BC-011-CC-012-AC-012-BC-012-CC-013-AC-013-BC-013-CC-014-AC-014-BC-014-CC-015-AC-015-BC-015-CC-016-AC-016-BC-016-CC-017-AC-017-BC-017-CC-018-AC-018-BC-018-CC-019-AC-019-BC-019-CC-020-AC-020-BC-020-CC-021-AC-021-BC-021-CD-001-AD-001-BD-001-CD-001-DD-002-AD-002-BD-002-CD-002-DD-003-AD-003-BD-003-CD-003-DD-004-AD-004-BD-004-CD-004-DD-005-AD-005-BD-005-CD-005-DD-006-AD-006-BD-006-CD-006-DD-007-AD-007-BD-007-CD-007-DD-008-AD-008-BD-008-CD-008-DD-009-AD-009-BD-009-CD-009-DD-010-AD-010-BD-010-CD-010-DD-011-AD-011-BD-011-CD-011-DD-012-AD-012-BD-012-CD-012-DD-013-AD-013-BD-013-CD-013-DD-014-AD-014-BD-014-CD-014-DD-015-AD-015-BD-015-CD-015-DD-016-AD-016-BD-016-CD-016-DD-017-AD-017-BD-017-CD-017-DD-018-AD-018-BD-018-CD-018-DD-019-AD-019-BD-019-CD-019-DD-020-AD-020-BD-020-CD-020-DD-021-AD-021-BD-021-CD-021-DD-022-AD-022-BD-022-CD-022-DD-023-AD-023-BD-023-CD-023-DD-024-AD-024-BD-024-CD-024-DE-001-AE-001-BE-001-CE-001-DE-002-AE-002-BE-002-CE-002-DE-003-AE-003-BE-003-CE-003-DE-004-AE-004-BE-004-CE-004-DE-005-AE-005-BE-005-CE-005-DE-006-AE-006-BE-006-CE-006-DE-007-AE-007-BE-007-CE-007-DE-008-AE-008-BE-008-CE-008-DE-009-AE-009-BE-009-CE-009-DE-010-AE-010-BE-010-CE-010-DE-011-AE-011-BE-011-CE-011-DE-012-AE-012-BE-012-CE-012-DE-013-AE-013-BE-013-CE-013-DE-014-AE-014-BE-014-CE-014-DE-015-AE-015-BE-015-CE-015-DE-016-AE-016-BE-016-CE-016-DE-017-AE-017-BE-017-CE-017-DE-018-AE-018-BE-018-CE-018-DE-019-AE-019-BE-019-CE-019-DE-020-AE-020-BE-020-CE-020-DE-021-AE-021-BE-021-CE-022-AE-022-BE-022-CE-023-AE-023-BE-023-CE-024-AE-024-BE-024-CE-025-AE-025-BE-025-CE-026-AE-026-BE-026-CE-027-AE-027-BE-027-CE-028-AE-028-BE-028-CE-029-AE-029-BE-029-CF-001-AF-001-BF-001-CF-001-DF-001-EF-001-FF-002-AF-002-BF-002-CF-002-DF-002-EF-002-FF-003-AF-003-BF-003-CF-003-DF-003-EF-003-FF-004-AF-004-BF-004-CF-004-DF-004-EF-004-FF-005-AF-005-BF-005-CF-005-DF-005-EF-005-FF-006-AF-006-BF-006-CF-006-DF-006-EF-006-FF-007-AF-007-BF-007-CF-007-DF-007-EF-007-FF-008-AF-008-BF-008-CF-008-DF-008-EF-008-FF-009-AF-009-BF-009-CF-009-DF-009-EF-009-FF-010-AF-010-BF-010-CF-010-DF-010-EF-010-FF-011-AF-011-BF-011-CF-011-DF-011-EF-011-FF-012-AF-012-BF-012-CF-012-DF-012-EF-012-FF-013-AF-013-BF-013-CF-013-DF-013-EF-014-AF-014-BF-014-CF-014-DF-014-EF-015-AF-015-BF-015-CF-015-DF-015-EF-016-AF-016-BF-016-CF-016-DF-017-AF-017-BF-017-CF-017-DF-018-AF-018-BF-018-CF-018-DF-019-AF-019-BF-019-CF-019-DF-019-EF-020-AF-020-BF-020-CF-020-DF-020-EF-012-AF-021-BF-021-CF-021-DF-021-EF-022-AF-022-BF-022-CF-022-DF-022-EF-023-AF-023-BF-023-CF-023-DF-023-EF-024-AF-024-BF-024-CF-024-DF-024-EF-025-AF-025-BF-025-CF-025-DF-025-EF-026-AF-026-BF-026-CF-026-DF-026-EF-027-AF-027-BF-027-CF-027-DF-027-EG-001-AG-001-BG-001-CG-001-DG-001-EG-001-FG-001-GG-002-AG-002-BG-002-CG-002-DG-002-EG-002-FG-002-GG-003-AG-003-BG-003-CG-003-DG-003-EG-003-FG-003-GG-004-AG-004-BG-004-CG-004-DG-004-EG-004-FG-004-GG-005-AG-005-BG-005-CG-005-DG-005-EG-005-FG-005-GG-006-AG-006-BG-006-CG-006-DG-006-EG-006-FG-006-GG-007-AG-007-BG-007-CG-007-DG-007-EG-007-FG-007-GG-008-AG-008-BG-008-CG-008-DG-008-EG-008-FG-008-GG-009-AG-009-BG-009-CG-009-DG-009-EG-009-FG-009-GG-010-AG-010-BG-010-CG-010-DG-010-EG-010-FG-010-GG-011-AG-011-BG-011-CG-011-DG-011-EG-011-FG-011-GG-012-AG-012-BG-012-CG-012-DG-012-EG-012-FG-012-GG-013-AG-013-BG-013-CG-013-DG-014-AG-014-BG-014-CG-014-DG-015-AG-015-BG-015-CG-015-DG-016-AG-016-BG-016-CG-016-DG-017-AG-017-BG-017-CG-017-DG-018-AG-018-BG-018-CG-018-DG-019-AG-019-BG-019-CG-019-DG-020-AG-020-BG-020-CG-020-DG-021-AG-021-BG-021-CG-021-DG-022-AG-022-BG-022-CG-022-DG-022-EG-022-FG-022-GG-023-AG-023-BG-023-CG-023-DG-023-EG-023-FG-023-GG-024-AG-024-BG-024-CG-024-DG-024-DG-024-EG-024-FG-024-GG-025-AG-025-BG-025-CG-025-DG-025-EG-025-FG-025-GG-026-AG-026-BG-026-CG-026-DG-026-EG-026-FG-026-GG-027-AG-027-BG-027-CG-027-DG-027-EG-027-FG-027-GH-001-AH-001-BH-001-CH-001-DH-002-AH-002-BH-002-CH-002-DH-003-AH-003-BH-003-CH-003-DH-004-AH-004-BH-004-CH-004-DH-005-AH-005-BH-005-CH-005-DH-006-AH-006-BH-006-CH-006-DH-007-AH-007-BH-007-CH-007-DH-008-AH-008-BH-008-CH-008-DH-009-AH-009-BH-009-CH-009-DH-010-AH-010-BH-010-CH-010-DH-011-AH-011-BH-011-CH-011-DH-012-AH-012-BH-012-CH-012-DH-013-AH-013-BH-013-CH-013-DH-014-AH-014-BH-014-CH-014-DH-015-AH-015-BH-015-CH-015-DH-016-AH-016-BH-016-CH-016-DH-017-AH-017-BH-017-CH-017-DH-018-AH-018-BH-018-CH-018-DH-019-AH-019-BH-019-CH-019-DH-020-AH-020-BH-020-CH-020-DH-021-AH-021-BH-021-CH-021-DH-022-AH-022-BH-022-CH-022-DH-023-AH-023-BH-023-CH-023-DH-024-AH-024-BH-024-CH-024-DH-025-AH-025-BH-025-CH-025-DH-025-AH-025-BH-025-CH-025-DH-026-AH-026-BH-026-CH-026-DH-027-AH-027-BH-027-CH-027-DJ-001-AJ-001-BJ-001-CJ-001-DJ-002-AJ-002-BJ-002-CJ-002-DJ-003-AJ-003-BJ-003-CJ-003-DJ-004-AJ-004-BJ-004-CJ-004-DJ-005-AJ-005-BJ-005-CJ-005-DJ-006-AJ-006-BJ-006-CJ-006-DJ-007-AJ-007-BJ-007-CJ-007-DJ-008-AJ-008-BJ-008-CJ-008-DJ-009-AJ-009-BJ-009-CJ-009-DJ-010-AJ-010-BJ-010-CJ-010-DJ-011-AJ-011-BJ-011-CJ-011-DJ-012-AJ-012-BJ-012-CJ-012-DJ-013-AJ-013-BJ-013-DJ-014-AJ-014-BJ-014-CJ-014-DJ-015-AJ-015-BJ-015-CJ-015-DJ-016-AJ-016-BJ-016-CJ-016-DJ-017-AJ-017-BJ-017-CJ-017-DJ-018-AJ-018-BJ-018-CJ-018-DJ-019-AJ-019-BJ-019-CJ-019-DJ-020-AJ-020-BJ-020-CJ-020-DJ-021-AJ-021-BJ-021-CJ-021-DJ-022-AJ-022-BJ-022-CJ-022-DJ-023-AJ-023-BJ-023-CJ-023-DJ-024-AJ-024-BJ-024-CJ-024-DJ-025-AJ-025-BJ-025-CJ-025-DK-001-AK-001-BK-001-CK-002-AK-002-BK-002-CK-003-AK-003-BK-003-CK-004-AK-004-BK-004-CK-005-AK-005-BK-005-CK-006-AK-006-BK-006-CK-007-AK-007-BK-007-CK-008-AK-008-BK-088-CK-009-AK-009-BK-009-CK-010-AK-010-BK-010-CK-011-AK-011-BK-011-CK-012-AK-012-BK-012-CK-013-AK-013-BK-013-CK-014-AK-014-BK-014-CK-015-AK-015-BK-015-CK-016-AK-016-BK-016-CK-017-AK-017-BK-017-CK-018-AK-018-BK-018-CK-019-AK-019-BK-019-CK-019-DK-020-AK-020-BK-020-CK-020-DK-021-AK-021-BK-021-CK-021-DK-022-AK-022-BK-022-CK-022-DK-023-AK-023-BK-023-CK-023-DK-024-AK-024-BK-024-CK-024-DK-025-AK-026-AK-026-BK-026-CK-026-DK-027-AK-027-BK-027-CK-027-DK-028-AK-028-BK-028-CK-028-DK-029-AK-029-BK-029-CK-029-DK-030-AK-030-BK-030-CK-030-DL-001-AL-002-AL-003-AL-004-AL-005-AL-006-AL-007-AL-007-BL-007-CL-008-AL-008-BL-008-CL-009-AL-009-BL-009-CL-010-AL-010-BL-010-CL-011-AL-011-BL-011-CL-012-AL-012-BL-012-CL-013-AL-013-BL-013-CL-014-AL-014-BL-014-CL-015-AL-015-BL-015-CL-016-AL-016-BL-016-CL-017-AL-017-BL-017-CL-018-AL-018-BL-018-CL-019-AL-019-BL-019-CL-020-AL-020-BL-020-CL-021-AL-021-BL-021-CL-022-AL-022-BL-022-CL-023-AL-023-BL-023-CL-023-DL-023-EL-024-AL-024-BL-024-CL-024-DL-024-EL-025-AL-025-BL-025-CL-025-DL-025-EL-026-AL-026-BL-026-CL-026-DL-026-EL-027-AL-027-BL-027-CM-001-AM-002-AM-003-AM-004-AM-005-AM-006-AM-007-AM-008-AM-009-AM-010-AM-010-BM-010-CM-011-AM-011-BM-011-CM-012-AM-012-BM-012-CM-013-AM-013-BM-013-CM-014-AM-014-BM-014-CM-015-AM-015-BM-015-CM-016-AM-016-BM-016-CM-017-AM-017-BM-017-CM-018-AM-018-BM-018-CM-019-AM-019-BM-019-CM-020-AM-020-BM-020-CM-021-AM-021-BM-021-CM-022-AM-022-BM-022-CM-023-AM-023-BM-023-CM-024-AM-024-BM-024-CN-001-AN-001-BN-001-CN-002-AN-002-BN-002-CN-003-AN-003-BN-003-CN-004-AN-004-BN-004-CN-005-AN-005-BN-005-CN-006-AN-006-BN-006-CN-007-AN-007-BN-007-CN-008-AN-008-BN-008-CP-001-AP-001-BP-001-CP-002-AP-002-BP-002-CP-003-AP-003-BP-003-CP-004-AP-004-BP-004-CP-005-AP-005-BP-005-CP-006-AP-006-BP-006-CP-007-AP-007-BP-007-CP-008-AP-008-BP-008-CP-009-AP-009-BP-009-CP-010-AP-010-BP-010-CP-011-AP-011-BP-011-CP-012-AP-012-BP-012-CP-013-AP-013-BP-013-CP-014-AP-014-BP-014-CP-015-AP-015-BP-015-CP-016-AP-016-BP-016-CP-017-AP-017-BP-017-CP-018-AP-018-BP-018-CP-019-AP-019-BP-019-CP-020-AP-020-BP-020-CP-020-AP-020-BP-020-CP-021-AP-022-BP-022-CP-023-AP-023-BP-023-CP-024-AP-024-BP-024-CP-025-AP-025-BP-025-CP-026-AP-026-BP-026-CP-027-AP-027-BP-027-CP-028-AP-028-BP-028-CP-029-AP-029-BP-029-CP-030-AP-030-BP-030-CP-031-AP-031-BP-031-CP-032-AP-032-BP-032-CP-033-AP-033-BP-033-CP-034-AP-034-BP-034-CP-035-AP-035-BP-035-CP-036-AP-036-BP-036-CR-001-AR-001-BR-001-CR-002-AR-002-BR-002-CR-003-AR-003-BR-003-CR-004-AR-004-BR-004-CR-005-AR-005-BR-005-CR-006-AR-006-BR-006-CR-007-AR-007-BR-007-CR-008-AR-008-BR-008-CR-009-AR-009-BR-009-CR-010-AR-010-BR-010-CR-011-AR-011-BR-011-CR-012-AR-012-BR-012-CR-013-AR-013-BR-013-CR-014-AR-014-BR-014-CR-014-DR-015-AR-015-BR-015-CR-015-DR-016-AR-016-BR-016-CR-016-DR-017-AR-017-BR-017-CR-017-DR-017-AR-017-BR-017-CR-017-DR-018-AR-018-BR-018-CR-018-DR-019-AR-019-BR-019-CR-019-DR-020-AR-020-BR-020-CR-020-DR-021-AR-021-BR-021-CR-021-DR-022-AR-022-BR-022-CR-022-DR-023-AR-023-BR-023-CR-023-DR-024-AR-024-BR-024-CR-024-DR-025-AR-025-BR-025-CR-025-DR-026-AR-026-BR-026-CR-026-DR-027-AR-027-BR-027-CR-027-DR-028-AR-028-BR-028-CR-028-DR-029-AR-029-BR-029-CR-029-DR-030-AR-030-BR-030-CR-030-DR-031-AR-031-BR-031-CR-031-D


----------



## Nicko87 (Jan 5, 2023)

sorry, first time user of this site


----------



## HaHoBe (Jan 5, 2023)

Hi Nicko87,

I don't understand what you're last three posts are about. Maybe you can habe a look at How to Add Code to Excel Workbook, the code supplied should go into a standard module.

Holger


----------

