View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Copy data of records to a templatesheet and save this template as pdf file (and then the other records one by one)

Hi Johan,

Am Tue, 22 Oct 2019 13:47:57 -0700 (PDT) schrieb JS SL:

For the part....

Sheets("Sheet3").Range("A1:C" & LRowSh3).AutoFilter field:=1, Criteria1:=varCrit(i, 2)
Sheets("Sheet3").Range("A2:C" & LRowSh3).Copy .Range("C57")
Sheets("Sheet3").AutoFilterMode = False

What to change if the selection of varCrit(i,2) doesnt give a selection because the searched item isn't in the list. In that case theres no selection and there should be no 'copy' to do.


try:

Sheets("Sheet3").Range("A1:C" & LRowSh3).AutoFilter field:=1, Criteria1:=varCrit(i, 2)
If Application.Subtotal(3, Sheets("Sheet3").Range("A1:A" & LRowSh3)) 1 Then
Sheets("Sheet3").Range("A2:C" & LRowSh3).Copy .Range("C57")
End If
Sheets("Sheet3").AutoFilterMode = False


Regards
Claus B.
--
Windows10
Office 2016