![]() |
Mantaining ranges if several sheets are selected
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 |
Mantaining ranges if several sheets are selected
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 Wrote: 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) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=58415 |
Mantaining ranges if several sheets are selected
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. "Simon Lloyd" wrote: 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 Wrote: 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) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=58415 |
Mantaining ranges if several sheets are selected
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 Wrote: 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. "Simon Lloyd" wrote: 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 Wrote: 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' ('The Code Cage' (http://www.thecodecage.com)) ------------------------------------------------------------------------ Simon Lloyd's Profile: 'The Code Cage Forums - View Profile: Simon Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1) View this thread: 'Mantaining ranges if several sheets are selected - The Code Cage Forums' (http://www.thecodecage.com/forumz/sh...ad.php?t=58415) -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=58415 |
Mantaining ranges if several sheets are selected
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!!!! "Simon Lloyd" wrote: 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 Wrote: 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. "Simon Lloyd" wrote: 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 Wrote: 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' ('The Code Cage' (http://www.thecodecage.com)) ------------------------------------------------------------------------ Simon Lloyd's Profile: 'The Code Cage Forums - View Profile: Simon Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1) View this thread: 'Mantaining ranges if several sheets are selected - The Code Cage Forums' (http://www.thecodecage.com/forumz/sh...ad.php?t=58415) -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=58415 |
Mantaining ranges if several sheets are selected
Thats Excel working perfect!, its supposed to do that as it assumes that because you have "Grouped" the sheets you want to perform a single action without having to edit each sheet individually, if you have something like the code i supplied then you don't need to group the sheets, if its because you only want it to happen on a few sheets rather than all then simply use an Array. filo666;213005 Wrote: 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!!!! "Simon Lloyd" wrote: 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 Wrote: 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. "Simon Lloyd" wrote: 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 Wrote: 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' ('The Code Cage' ('The Code Cage' (http://www.thecodecage.com))) ------------------------------------------------------------------------ Simon Lloyd's Profile: 'The Code Cage Forums - View Profile: Simon Lloyd' ('The Code Cage Forums - View Profile: Simon Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1)) View this thread: 'Mantaining ranges if several sheets are selected - The Code Cage Forums' ('Mantaining ranges if several sheets are selected - The Code Cage Forums' (http://www.thecodecage.com/forumz/sh...d.php?t=58415)) -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' ('The Code Cage' (http://www.thecodecage.com)) ------------------------------------------------------------------------ Simon Lloyd's Profile: 'The Code Cage Forums - View Profile: Simon Lloyd' (http://www.thecodecage.com/forumz/member.php?userid=1) View this thread: 'Mantaining ranges if several sheets are selected - The Code Cage Forums' (http://www.thecodecage.com/forumz/sh...ad.php?t=58415) -- Simon Lloyd Regards, Simon Lloyd 'The Code Cage' (http://www.thecodecage.com) ------------------------------------------------------------------------ Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1 View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=58415 |
All times are GMT +1. The time now is 09:23 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com