Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Selection 1

Status
Not open for further replies.

nickjar2

Programmer
Jun 20, 2001
778
US
Hopefully someone will know how to sort this strange problem out. I just hope i explain it properly.

I have this snippet of code:
Range("A3:O" & iRows, "A86:O101").Select where iRows is a number. Eg. if iRows = 18 then i want A3:O18 selected and then A86:O101, obviously not selecting the bit in between. This however selects the whole thing, incl bit inbetween. Without the iRows (hard coding it with a number) ie A3:O18 OR just using Range("A3:O" & iRow) works fine, but when i use a variable AND the ', "A86:O101")' part i get problems.
Please let me know if what I have written makes absolutely no sense at all and I will attempt to rephase it. It looks sort of ok to me, but that is probably because iam explaining my problem.

Cheers

Nick
 
I think your comma may be out of place, and you need another &

Range("A3:O" & iRows & ",A86:O101").Select

So it comes out as Range(A3:Oi,A86:0101).select

This works for me.
 
Goska, I cannot believe how thick I was. I would never have noticed that in a million years. My forte is Access/VBA and excel.

Thanks very much,

Nick
 
No problem. I do those all the time too and I hate when it takes me 3 days to find it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top