My Assistant
![]() ![]() |
|
|
Aug 12 2004, 02:09 PM
Post
#1
|
|
|
UtterAccess VIP Posts: 7,132 From: Perris, California |
I'm far from an Excel person!
I need to sort (or group) some shaded cells on a worksheet. History: 6000+ rows, 5000 or so of them being shaded yellow. Need to group all of the yellow shaded at the top of the page. Only needed for a one time deal. Any suggestions will be appreciated. Thanks. |
|
|
|
Aug 12 2004, 03:22 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 2,601 From: Dallas, Texas USA |
Is there any criteria for the rows to be shaded yellow?
Eric |
|
|
|
Aug 12 2004, 03:32 PM
Post
#3
|
|
|
UtterAccess VIP Posts: 7,132 From: Perris, California |
No, That's the problem, there were manually shaded, I had already thought of that, but there was nothing to use to do it.
Since it was a one time only deal, I just put '1' in all of the shaded cells of a blank column and sorted by that. Problem Solved. But since I love learning, can any offer a solution for something like this in the future? Thanks. |
|
|
|
Aug 12 2004, 03:35 PM
Post
#4
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
Hello Anthony,¨
see if this small utility helps. paste the Module1, Userform1 and eventually Sheet1 class code into your workbook. I know you're VB guru so I believe no further instructions needed. You could do the following: 1) make a back-up of your sheet (IMG:http://www.utteraccess.com/forum/style_emoticons/default/grin.gif) 2) With the manipulated sheet active, run ShowMe() sub. 3) Pick up the column and color (yellow), click Filter 4) Select the range, go to Edit=>Go To=>Special=>Visible, then Copy, paste into a new sheet. 5) go back to the original sheet, delete the filtered rows (that you have copied by now) 6) now only the rest of the rows remained, copy them below the rows copied below I hope I am not too confusing (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif) regards, (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif) Martin |
|
|
|
Aug 13 2004, 03:35 AM
Post
#5
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
Hello again Anthony,
I have posted my post without noticing that you'd sorted your prob already. However, this may come handy for the future: (1) One could think of the following code: Sub SortOutActiveCellColor2() This simple code loops through all cells within the active cell's column and compares their interior color to the one of the Active Cell. If matched then the row is cut/inserted at the top, etc. this code is veeeery slooow, as it does up to some 10000 cut/paste processes (I tested on enclosed workbook - 10000 data rows). Hit Ctrl & Break after you get bored (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif) I did always. (2) Your approach is much better. The problem is that you should loop again and decide whether to put "1" or not, then sort. this would be much faster then the first example but the loop still remains. Unfortunately Excel offers no formula that extracts the interior color - such a formula could be entered into the inserted column in one blow, range sorted and the thing's done in a jiffy. Good thing is that there's an ancient Excel4 formula "GET.CELL" that you can't use in a worksheet but YOU CAN use it in named formulas. This code automates what you did manually - only it puts the real colorindex instead of "1" and all the other colors are returned as "0". i also index the original rows in order to be sure that the order stays. this may not be necessary. here's the code (testing workbook attached) Sub SortOutActiveCellColor() Best regards, (IMG:http://www.utteraccess.com/forum/style_emoticons/default/frown.gif) Martin |
|
|
|
Aug 13 2004, 03:40 AM
Post
#6
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
I don't think the first attachment made it.
Here it is once more. M. |
|
|
|
Aug 13 2004, 07:55 AM
Post
#7
|
|
|
Retired Moderator Posts: 10,959 From: Prague,CZ / Kiev,UA |
Please disregard the first code I've posted. Not only it's slow, it can also end up in infinite loop =>Ctrl+Break is a must.
Here's the corrected (but still not recommended version): Sub SortOutActiveCellColor2() Sorry for that martin |
|
|
|
Aug 13 2004, 02:48 PM
Post
#8
|
|
|
UtterAccess VIP Posts: 7,132 From: Perris, California |
The utility worked perfectly!!!
I tested on a smaller amount of data, but have passed it on to my client who needed to do it on his own. I'll post back the feedback/results from it. Thanks. |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 26th May 2013 - 01:00 AM |