View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
JS SL JS SL is offline
external usenet poster
 
Posts: 49
Default Copy data of records to a templatesheet and save this template aspdf file (and then the other records one by one)

One question in the rebound :)

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.

Something like;

If no results of selection;
Sheets("Sheet3").Range("A1:C" & LRowSh3).AutoFilter field:=1, Criteria1:=varCrit(i, 2)

Then
...
Else
Sheets("Sheet3").Range("A2:C" & LRowSh3).Copy .Range("C57")
Sheets("Sheet3").AutoFilterMode = False
End if

I'd tried something like this, but....... :(

What's the solution. Please :)