Mantaining ranges if several sheets are selected

F

filo666

Hi, I have a macro that takes all the ranges of the selected cells (in each
worksheet) and paste them wherever the user wants, the thing is when I select
two or more sheets the ranges of all the sheets are lost and in all the
sheets appears the range of the first sheet, how can I mantain the ranges in
all the selected sheets?
TIA
 
S

Simon Lloyd

Firstly it would be helpful if you could post the code you are using,
secondly you don't say how you define the range in each sheet, when you
say selected sheets are you grouping them? if not by what means are you
or the user selecting them?

filo666;212818 said:
Hi, I have a macro that takes all the ranges of the selected cells (in
each
worksheet) and paste them wherever the user wants, the thing is when I
select
two or more sheets the ranges of all the sheets are lost and in all the
sheets appears the range of the first sheet, how can I mantain the
ranges in
all the selected sheets?
TIA


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
 
F

filo666

the code is huge, impossible to paste it, simple:
the user selects range a1:a5 and range b3:c5 from sheet1, he selects range
g4:g6 and range v6:n9 from sheet2, he selects both sheets and the ranges of
sheet1 are lost.
 
S

Simon Lloyd

Your code would need to be on the lines of:
Code:
--------------------
Dim Sh As Worksheet
For each Sh in sheets
with selection
'do something with the selected range
End with
--------------------

If you would like to show a workbook you can join the forum shown below
for free, when making a post you can attach a workbook prior to
submitting your post, if you do join and post a question related to this
one please post it in this thread (link can be found below) so that
others who have been helping or following the thread can still do so.

filo666;212943 said:
the code is huge, impossible to paste it, simple:
the user selects range a1:a5 and range b3:c5 from sheet1, he selects
range
g4:g6 and range v6:n9 from sheet2, he selects both sheets and the
ranges of
sheet1 are lost.


Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1)
The Code Cage Forums'
(http://www.thecodecage.com/forumz/showthread.php?t=58415)


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
 
F

filo666

I already have that part in my code, let me try to explain my self better:

Could you do this please:

1)select range("A1:A6") in sheet1
2)select range("v1:v6") in sheet2
3)select sheet1 and sheet2 (with key shift presed and cliking with your mouse)
4) now enter to sheet1 or to sheet2, you will find out that one of your
ranges was lost!!!!
 
S

Simon Lloyd

Thats Excel working perfect!, its supposed to do that as it assumes tha
because you have "Grouped" the sheets you want to perform a singl
action without having to edit each sheet individually, if you hav
something like the code i supplied then you don't need to group th
sheets, if its because you only want it to happen on a few sheets rathe
than all then simply use an Array

filo666;213005 said:
I already have that part in my code, let me try to explain my sel
better

Could you do this please

1)select range("A1:A6") in sheet
2)select range("v1:v6") in sheet
3)select sheet1 and sheet2 (with key shift presed and cliking with you
mouse
4) now enter to sheet1 or to sheet2, you will find out that one of you
ranges was lost!!!







Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1
The Code Cage Forums
(http://www.thecodecage.com/forumz/showthread.php?t=58415

--
Simon Lloy

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com
 
Top