Lookup set value, with multiple results.

robbo0224

New Member
Joined
Sep 17, 2014
Messages
23
Hi all,

I need help with a project i'm working on.
I have a sheet where I need to find and print worksheets based on weather that PPM is needed to be completed that month.
So for example, to Print all ppm's to be completed in week 6. I'd enter week 6 in the box and it looks up this week number in a row, then finds all occurrences of the number '1' in the column (there will be multiple) then look left to find the hyperlink to the sheet and print.

I need help with the lookup and looping it to find every entry.
Any help would be awesome. I'd attach the workbook, but i don't know how :-(
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Hmmm, it worked when I tried it in preview mode and just selecting the sheets all at once. Did you rename the source sheet to Master?
 
Last edited:
Upvote 0
I tried both, changing Master to the sheet name and changing the sheet name to master and both debug at the same point
 
Last edited:
Upvote 0
The plot thickens, when it debugs and i right click and look at the definition, it says; 'Cannot jump to 'Sheets' because it's hidden'
I've double checked and there are no hidden sheets in the workbook, so i dont know why that's coming up
 
Upvote 0
And I got an error when trying to preview again (???). Here's a code which passes the sheetnames to an array, how does that go?

Code:
Sub printhyperlinks()
Dim Week%, Col%, LastRow%, M As Worksheet, sheetarr(), i%, j%
Set M = Sheets("Master")
LastRow = M.Cells(Rows.Count, 2).End(xlUp).Row
Week = InputBox("Please enter Week number:")
Col = Application.Match("Week " & Week, M.Range("C1:J1"), 0) + 2
j = 0
For i = 1 To LastRow
If M.Cells(i, Col).Value = "X" Then
ReDim Preserve sheetarr(j)
sheetarr(j) = M.Cells(i, 2).Value
j = j + 1
Else
End If
Next
Sheets(sheetarr).PrintOut Copies:=1, Collate:=True
End Sub
 
Upvote 0
No I was able to preview with the whole array, no looping needed. Are you sure the cells in that column match the sheet names exactly?
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top