Hello, I am working on a code and I would like it to PrintOut some sheets. I want some lines to repeat on each page. My problem is that the row number is a variant so I can't put it in the form :"$7:$8". They are like variant. I've tried many things but none of them seems to be working. Is there special way to declare a variant? Shall my first and second variant be declared as something? I've tried Row but this didnt works
Thank you
Thank you
Code:
Dim i, a, b, nb_ligne1 As Integer
a = 0
For i = 5 To 12
nb_ligne1 = Sheets(i).Range("A2").Value
For b = 6 To nb_ligne1
Sheets(i).Activate
If Sheets(i).Cells(b, "I") = "Good" Then
a = a + 1
End If
Next b
First = a + 7
second = a + 8
If nb_ligne1 > 4 Then
ThisWorkbook.Sheets(i).Activate
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = First & ":" & second
.PrintTitleColumns = ""
End With
End If
Next i
Last edited: