how to select multiple cells and move the selection into a '

jonybegood

New Member
Joined
Jan 20, 2003
Messages
6
Hi,

I have a problem I haven't been able to solve:
how to select multiple cells (not contiguous)
and increment to the bottom the selection to keep only one row ?
here is the example:
range(B2:D2,B10:D10,B18:D18)
I want to make an increment like that:
range(B3:D3,B11:D11,B19:D19)
range(B4:D4,B12:D12,B20:D20)
..........
but automatically

thank you for your help :)
This message was edited by jonybegood on 2003-01-22 06:14
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Can you clarify:
"increment to the bottom the selection to keep only one row"

a bit
This message was edited by hedrijw on 2003-01-21 16:06
 
Upvote 0
-----------
-an you clarify:
"increment to the bottom the selection to keep only one row"
-----------
ooops it is hard to explain (I am french) lol.
I want to select the next cell in the column
I would like to make that:

I have this selection at first
range(B2:D2,B10:D10,B18:D18).select

and I would like a loop to make row+1 in that way and obtain:
range(B3:D3,B11:D11,B19:D19) .....

thank you for your help
 
Upvote 0
Dim r As Long
For r = 0 To 7 'Change as required
Range("B2:D2,B10:D10,B18:D18").Offset(r, 0).Select
r = r + 1
Next
This message was edited by Ponsonby on 2003-01-21 18:38
 
Upvote 0
thank you very much for your reply !
I have tried it :)
but how to move all the selection at the same time ?
when I do :
range(B2:D2,B10:D10,B18:D18).select
it select the 3 rows
but with the loop you gave me , it select the first one (B2:D2) , in the second time in the loop it select (B10:D10) ...
is it possible to keep all the selection and increment all the rows at the same time ??

thank you for very much
 
Upvote 0
I don't really understand your post, but the macro I posted was not quite correct.

Below is an amended macro. I've added a message box to show what the macro does :-

The macro first selects Range("B2:D2,B10:D10,B18:D18"), then selects Range("B3:D3,B11:D11,B19:D19"), and so on until Range("B9:D9,B17:D17,B25:D25").
Is this what you want to do?

Dim x As Long, r As Long
For x = 0 To 7 'Change as required
Range("B2:D2,B10:D10,B18:D18").Offset(r, 0).Select
r = r + 1
MsgBox Selection.Address(False, False)
Next
 
Upvote 0
after some more searches I have found a solution which work very well , here it is:

Sub PlageMultiple()
Dim Plage1 As Range, Plage2 As Range, Plage3 As Range, Plages As Range


For i = 0 To 7
Set Plage1 = Range("B2:D2").Offset(i, 0)
Set Plage2 = Range("B10:D10").Offset(i, 0)
Set Plage3 = Range("B18:D18").Offset(i, 0)
Set Plages = Union(Plage1, Plage2, Plage3)
Plages.Select
Next
End Sub


thank you very for your help :) :)
 
Upvote 0
hi Ponsonby,

Thank you for your last help :)
you can see what I wanted to do into my last post(the solution I have found).
in your program , there was only one line selected at a time.
 
Upvote 0
I really do not understand why you say that the code I posted only selects one row at a time.

When I run the macro, all three rows get selected and I can see nothing in the code that would make it do otherwise.

Did you copy and paste the code exactly as I posted it?

You are saying that the code :-
Range("B2:D2,B10:D10,B18:D18").Select
only selects B2:D2 ?

I don't see how that is possible.
 
Upvote 0
Hi Ponsoby,

I have tried again the last code you gave me
and it select only the first row (B2:D2) at first, the second time in the loop it select (B3:D3), the third time in the loop it select (B4:D4) .....
I am using excel 97
the code does not work like that into your excel ?
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,207
Members
448,554
Latest member
Gleisner2

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top