Re: Copy Named Range Chosen From Drop-Down & Paste To Last Row
Try the attached and see if this doesn't get you started on an alternative solution; it just hides the rows you don't want printed, prints (previews just for now), and unhides them again.
I've added a userform and a listbox, this code behind the userform:
this code behind the Print button on the sheet:
and this code in a standard module:
Code
With UserForm1
.ListBox1.List = Array("27 Hairdressing", "41 Vehicles", "40 Fragrance Series ", "42 Steroids", "25 Dental Battery", " Plant Series", "25 Dental Materials (Dyes)", "44 Clothing and Footwear", "35 Sunscreen agents", "26 Plastics (Prosthetics)", "26 Plastics and Glues", "Leg Ulcer", "40 Perfumes and Flavours")
.Show
Dim r As Range
For i = 0 To .ListBox1.ListCount - 1
If Not .ListBox1.Selected(i) Then
Debug.Print .ListBox1.List(i)
Set r = Sheets("Master").Columns(1).Find(.ListBox1.List(i))
If Not r Is Nothing Then
r.CurrentRegion.EntireRow.Resize(r.CurrentRegion.Rows.Count + 1).Hidden = True
End If
End If
Next i
End With
ActiveWindow.SelectedSheets.PrintPreview
Sheets("Master").Cells.EntireRow.Hidden = False
Unload Userform1
End Sub
Display More