Question on how to reference multiple cells in VBA

  • Thread starter Thread starter louisamarkham
  • Start date Start date
L

louisamarkham

I am trying to select cells in a row that are not contiguous. Example
in row 15 i want select C, E, J, I, and K. I used the record macro
function to get

Range("C15,E15,G15,I15,K15").Select

but it will not always be row 15. I am adding rows to a spreadsheet via
a custom written macro and I am trying to select the different cells to
format them.

Thank you for any help,

Louis Markham
 
One way

Range("C" & i & ",E" & i & ",G" & i & ",I" & i & ",K" & i).Select

where i has your row number

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top