Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50057

Select range of multiple cells with variable row number

$
0
0
Hi

Short question is: I need to select cells Q(x) to S(x) within a macro.

Background is -

Within a macro that runs down a list of data, (x = rows 1-100) checking an IF statement, and if true, pulling data from various columns in current row x, to send an email from Lotus Notes.

For each entry, the email addresses that the email needs to go to are in Q, R and S. Some entries have only one email address, in Q, some use two or all three cells.

The macro works fine when using only one email address in Q, using code with macro of recipient = z and
Code:

z = ThisWorkbook.Worksheets("Balances Summary").Range("Q" & x).Value.
But since I cannot make the macro work with multiple email addresses in one cell (which would also be a fine resolution, if anyone knows how to do that!), I need to be able to have the macro select a variable range.

But I do not know how to select more than one cell containing a variable, all methods I have guessed at so far did not work.

I would be very grateful for any help!

Viewing all articles
Browse latest Browse all 50057

Trending Articles