Multiple Ranges = same value

J

jlclyde

I have 3 ranges, that I want to = the same number. I am doing this
with VBA. Is there an easier way then
Range("A3") = 5
Range("A9") = 5
Range"E42")=5
??
Thanks,
Jay
 
G

Gary''s Student

Sub servient()
Range("A3,A9,E42").Value = 5
End Sub

another way is to use Union()

I think that with regard to speed, it does not matter.
 
D

Dave Peterson

Except for the typo <vbg>, that looks the easiest to me.

But you could use:
ActiveSheet.Range("a3,a9,e42").Value = 5

This worked in xl2003.
 
J

jlclyde

Sub servient()
Range("A3,A9,E42").Value = 5
End Sub

another way is to use Union()

I think that with regard to speed, it does not matter.
--
Gary''s Student - gsnu2007k





- Show quoted text -

Thanks. I was trying Range("A3", "A9", "E42"). this will be much
easier!
Jay
 

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

Top