I am writing an Excel macro to send emails from data in a spreadsheet. The data are in a table with each column providing different variables to create the email (to:, cc:, subject, attachments, etc).
I’ve got the macro to do what I want on one line of the table. My question is:
How do I scale the VBA code to work for each line of my table? I would like a hyperlink in each row to run the macro using the data in that row. Below is a small snippet of my code as an example:
Sub SendMail() Dim xContractNumber As String xContractNumber = Worksheets("Program Info").Range("L10").Value End Sub
In the above example, I would like a hyperlink that runs the macro using the data in row 10 of the ‘Program Info’ sheet… And another button or link that would run the macro using data in row 11, and so on.