Opening Multipe Files Via VBA
I have the following code which looks for a value of true in column B, then
opens it's associated .pdf hyperlinked in column E. The problem I'm having is that this stops after finding the first 'True' value in the range, openng only one file. Is there a way to have this continue and open ALL files with the 'True' value in column B? Thanks for any insight! Private Sub PrintEqButton_Click() For Each r In Range("B1:B200") If r.Value = True Then s = r.Offset(0, 3).Value ActiveWorkbook.FollowHyperlink Address:=s Exit Sub End If Next End Sub |
Opening Multipe Files Via VBA
Remove the Exit Sub.
-- Wigi http://www.wimgielis.be = Excel/VBA, soccer and music "Eric" wrote: I have the following code which looks for a value of true in column B, then opens it's associated .pdf hyperlinked in column E. The problem I'm having is that this stops after finding the first 'True' value in the range, openng only one file. Is there a way to have this continue and open ALL files with the 'True' value in column B? Thanks for any insight! Private Sub PrintEqButton_Click() For Each r In Range("B1:B200") If r.Value = True Then s = r.Offset(0, 3).Value ActiveWorkbook.FollowHyperlink Address:=s Exit Sub End If Next End Sub |
Opening Multipe Files Via VBA
Thanks Wigi!
"Wigi" wrote: Remove the Exit Sub. -- Wigi http://www.wimgielis.be = Excel/VBA, soccer and music "Eric" wrote: I have the following code which looks for a value of true in column B, then opens it's associated .pdf hyperlinked in column E. The problem I'm having is that this stops after finding the first 'True' value in the range, openng only one file. Is there a way to have this continue and open ALL files with the 'True' value in column B? Thanks for any insight! Private Sub PrintEqButton_Click() For Each r In Range("B1:B200") If r.Value = True Then s = r.Offset(0, 3).Value ActiveWorkbook.FollowHyperlink Address:=s Exit Sub End If Next End Sub |
All times are GMT +1. The time now is 09:55 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com