VBA column print hyperlinks

Zigman36

New Member
Joined
Mar 19, 2024
Messages
6
Office Version
  1. 365
Platform
  1. Windows
Hi All,

Need to the world of VBA so apologies before I start!
I have a column for each week of the year, in each column I have a few hyperlinks that are required to be printed off in as each week begins.

So far I have created a Command button and assigned the VBA below (for the first column representing Week 1 'col L')
This is manually selected by the user at week start.
Question is,
Is the best way forward to create and 50+ more command buttons and add 50+ modules with code to assign against or is there any better methods? Maybe using a calendar etc?
Thanks in advance!

Sub ButtonJan1_Click()
'
' ButtonJan1_Click Macro
' Jan 1 Print all hyperlinks
'

'
Range("L8:L108").Select
Selection.Hyperlinks(1).Follow NewWindow:=False, AddHistory:=True
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
IgnorePrintAreas:=False
Sheets("Annual Overview").Select
ActiveSheet.Shapes.Range(Array("Button 23")).Select
Application.GoTo Reference:="ButtonJan1_Click"
ActiveWorkbook.Save
ActiveWorkbook.Save
End Sub
 
How would I code "If cell L8 has a value, then print hyperlink in cell B8"?
VBA Code:
If Range("L8")<>"" Then 
   Range("L8").Offset(0,-10).Hyperlinks(1).Follow
   'then your print code next
End If
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,223,893
Messages
6,175,246
Members
452,623
Latest member
cliftonhandyman

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