Renamed ranges - PART 2

G

Guest

Hi there,

I think my reply to my earlier question has got pushed quite far down and as
I still have another question regarding this issue so am reposting it. For
first part of issue please see further below for history and reply from Mat
P:son.

So, assuming you have read Part 1, I shall continue : my total number of
pages being variable (see code for this in Part 1 below), I would like to
know if it is possible to print the range names on each page as a footer. So
for example "COMMANDE" on pages 1-2, "ETIQUETTES DESTINATAIRE" on pages 3-4
and then "CONDITIONNEMENT_1" etc. I had previously asked the same kind of
question but hadn't specified that the number of pages would be variable and
so the person gave me a solution using specific page numbers :

Sub ToPrintFooter()

Dim A As Integer
With Sheet1
For A = 1 To 5
With .PageSetup
.LeftFooter = "COMMANDE"
End With
.PrintOut From:=A, To:=A, Preview:=True
Next
For A = 6 To 8
With .PageSetup
.LeftFooter = "ETIQUETTES_DESTINATAIRE"
End With
.PrintOut From:=A, To:=A, Preview:=True
Next
For A = 9 To 10
With .PageSetup
.LeftFooter = "ETIQUETTES_PRODUIT"
End With
.PrintOut From:=A, To:=A, Preview:=True
Next
End With
End Sub

Does anyone have any idea as to how this could work with the variable range
names and pages?

Thankyou!
rm8
------------------------------------------------------------------------------------------------
RENAMED RANGES - PART 1

Hi there,

I'm not entirely sure how you envisage the printing part of the problem to
work so I can't really help you there, but at least it won't be a major
problem to set cell range names programmatically:

Try for example this (and change as required for the ETIQUETTES_PRODUIT
part, of course):

For i = 2 To v
'Copies the Conditionnement pages
Range("CONDITIONNEMENT").Select
Range("CONDITIONNEMENT").Copy
Selection.Insert Shift:=xlDown
Selection.Name = "CONDITIONNEMENT_" & CStr(i)
Next i
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Renaming a range 16
Printing issue 1
Print two ranges on page 2
Print Ranges 7
Fit to page macro 3
Print area problem 1
Macro Creates Mult Sheets Based on Summary 2
error VBA next without for 1

Top