Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.misc,microsoft.public.excel.programming,comp.apps.spreadsheets
external usenet poster
 
Posts: 1
Default Locking cell color pattern when sorting rows?

I am creating a spreadsheet where I want every alternating row to have
a light grey solid pattern that acts as shading, so it is easier to
follow individual rows from column to column on a printed page.
The problem is that when I choose to sort rows by a specific data
property in any column, the shading pattern becomes messed up, because
there doesnt seem to be a way to lock the shaded pattern of each cell.
Is there a solution to this problem? Thanks
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.misc,microsoft.public.excel.programming,comp.apps.spreadsheets
external usenet poster
 
Posts: 10
Default Locking cell color pattern when sorting rows?

Sanjay;

Might this be a solution ?
Seperate lines between groups of data by using conditional formatting.

- In a spreadsheet, build a table.
( B4..C22 where B4 is type and C4 is value )

First sort Range (B5..C22) and then select it.
Choose: Format |Conditional Formatting from the menu.
In the first Dropdownbox choose : Fomula =
In the Conditionbox type : =$B5<$B6

Set the condition by clicking Format. In this case choose a line at the
bottom.

When you look at the table, a line appears after every new type.

!! Typing the reference to B5, does not mean that all conditional
formatting refers to B5.
The Conditional formatting in cell B6, does refers to B6 and so on.

This is where you can find the tip !

http://www.rosenkrantz.nl/functiontip07.htm

Mark Rosenkrantz.

More Excel ? www.rosenkrantz.nl or




"Sanjay Punjab" wrote in message
om...
I am creating a spreadsheet where I want every alternating row to have
a light grey solid pattern that acts as shading, so it is easier to
follow individual rows from column to column on a printed page.
The problem is that when I choose to sort rows by a specific data
property in any column, the shading pattern becomes messed up, because
there doesnt seem to be a way to lock the shaded pattern of each cell.
Is there a solution to this problem? Thanks



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.misc,microsoft.public.excel.programming,comp.apps.spreadsheets
external usenet poster
 
Posts: 33
Default Locking cell color pattern when sorting rows?

For those who are in danger of running out of room with too many conditional
formats (That would be me), this works well enough: (P.S. Please excuse the
Canadian spelling of "Color")

This routine will identify every second visible row, collect it in a union
of ranges, and finally set the colour in a single step. Both white and
non-white backgrounds need to be processed to clear previous colors (one
could also set all colours in the range white, and then just set the
non-white colour).

Alex@JPCS



Sub FastColour()
Dim Sht As Worksheet
Dim Target as Range
Dim rwrange(0 To 1) As Range 'Array of ranges
Dim visrow As Integer

Application.ScreenUpdating = False
Application.EnableEvents = False

Set Target = Sht.Range("DataRange") 'Identifies range of
data to be coloured
tgtrows = Target.Rows.Count

n = 0
On Error GoTo ERR01 'First Union
Command will cause an error
With Target
For rw = 1 To tgtrows
Set Tgt2 = .Rows(rw)
'Assign for yellow background
If Not Tgt2.Hidden Then 'Ensures
after a filter command that only visible rows are coloured
n = n + 1
visrow = n Mod 2
Set rwrange(visrow) = Union(rwrange(visrow),
Tgt2)
End If
Next rw
On Error GoTo 0

End With

If rwrange(0) Is Nothing Then
GoTo RW1
Else
rwrange(0).Interior.ColorIndex = vbWhite
End If
RW1:
If rwrange(1) Is Nothing Then
GoTo XIT
Else
rwrange(1).Interior.ColorIndex = vbRed 'Pick a
color ........
End If

XIT:
Set Sht = Nothing
Set Target = Nothing
Set Tgt2 = Nothing
For i = LBound(rwrange) To UBound(rwrange)
Set rwrange(i) = Nothing
Next i
Application.ScreenUpdating = True
Application.EnableEvents = True
Exit Sub

ERR01:
Err.Clear
Set rwrange(visrow) = Tgt2
Resume Next

End Sub







"David McRitchie" wrote in message
...
The question relates to simulating the green bar
computer paper with alternating color stripes of generally
several lines high for each strip when on paper, or 1 line high
for spreadsheets. But Mark's answer on grouping on the
data was interesting.

But first, adding to Ken's examples, there are a few more things that
can be picked up in Chip Pearson's page, if you want to make
additional adjustments.
Color Banding With Conditional Formatting
http://www.cpearson.com/excel/banding.htm

---
Back to Mark's example involving grouping on the data (which has
nothing to do with the question). The sorting mentioned also
has nothing to do with the Conditional Formatting. There is
one thing I stress on my condfmt.htm page and that is that the
formula is *based* on the active cell. You will see that in
the example he provided but it is not very obvious. Directions
below are for the entire sheet.

First use Ctrl+A to select all cells then apply border
formatting (inside and outline) of dotted lines -- do this because
C.F. will wipe out gridlines.

Then Select all cells, Ctrl+A, with A1 being the active cell,
Formula 1 is: =$A1<$A2
borders choose dotted lines, then left and right borders
choose solid line, then bottom border

I had not realized before that C.F. did not have a full complement
of borders so one can't choose a thicker line, so the default of
dotted lines helps to make the solid lines stand out.
(just in case Excel 2002 differs, mine is Excel 2000)
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Mark Rosenkrantz" wrote in message

...
Sanjay;

Might this be a solution ?
Seperate lines between groups of data by using conditional formatting.

- In a spreadsheet, build a table.
( B4..C22 where B4 is type and C4 is value )

First sort Range (B5..C22) and then select it.
Choose: Format |Conditional Formatting from the menu.
In the first Dropdownbox choose : Fomula =
In the Conditionbox type : =$B5<$B6

Set the condition by clicking Format. In this case choose a line at

the
bottom.

When you look at the table, a line appears after every new type.

!! Typing the reference to B5, does not mean that all conditional
formatting refers to B5.
The Conditional formatting in cell B6, does refers to B6 and so on.

This is where you can find the tip !

http://www.rosenkrantz.nl/functiontip07.htm

Mark Rosenkrantz.

More Excel ? www.rosenkrantz.nl or




"Sanjay Punjab" wrote in message
om...
I am creating a spreadsheet where I want every alternating row to have
a light grey solid pattern that acts as shading, so it is easier to
follow individual rows from column to column on a printed page.
The problem is that when I choose to sort rows by a specific data
property in any column, the shading pattern becomes messed up, because
there doesnt seem to be a way to lock the shaded pattern of each cell.
Is there a solution to this problem? Thanks







  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.misc,microsoft.public.excel.programming,comp.apps.spreadsheets
external usenet poster
 
Posts: 1
Default Locking cell color pattern when sorting rows?

"Alex@JPCS" wrote in message
...
For those who are in danger of running out of room with too many

conditional
formats (That would be me), this works well enough: (P.S. Please excuse

the
Canadian spelling of "Color")

This routine will identify every second visible row, collect it in a union
of ranges, and finally set the colour in a single step. Both white and
non-white backgrounds need to be processed to clear previous colors (one
could also set all colours in the range white, and then just set the
non-white colour).


<SNIP

As a Brit I can tell you there is absolutely no reason for you to apologise
for spelling it "Colour". This is in fact the correct spelling.
--
Slartibartfast
To reply by email, remove the FJORDS from my address


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.misc,microsoft.public.excel.programming,comp.apps.spreadsheets
external usenet poster
 
Posts: 33
Default Locking cell color pattern when sorting rows?

Boys -
Sorry I mentioned the spelling thing.
Anybody have comments or improvements on "FastColour" ?

Alex@JPCS


"Ken Wright" wrote in message
...
Mid 30s all week is the forecast, and me on hols for a couple of weeks

:-) - We wouldn't give
it away whilst it is like this anyway. :-)

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL2K & XLXP

--------------------------------------------------------------------------

--
Attitude - A little thing that makes a BIG difference
--------------------------------------------------------------------------

--



"Harlan Grove" wrote in message

...
"Slartibartfast" wrote...
..
As a Brit I can tell you there is absolutely no reason for you to

apologise
for spelling it "Colour". This is in fact the correct spelling.

..

First we expropriate your colonies, then your language . . . but we're

not
greedy. You can keep your weather and your royal family.








  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.misc,microsoft.public.excel.programming,comp.apps.spreadsheets
external usenet poster
 
Posts: 134
Default Locking cell color pattern when sorting rows?

Here are comments then:

You did not get comments because you did not ask for comments.
Heck we don't even get answers telling anyone which solution works when
there is more than one suggestion.

Your posting really had very little to do with the question (in my opinion),
so is not helping the poster
So I would assume that it does not present the best solution to the
original poster and they would not use it.
Probably provides an additional
burden in trying to figure out best answer, how to procede..
If you have something new post it to one group and **ask for comments**
and what in the way of comments you are especially looking for.
Since it is code it should be to the programming group - ONLY.
Too late for that you get your your comments here.

Here are some comments on the macro:
-- If you can do something with conditional formatting using builtin
worksheet functions, then no macro is going to match efficiency.
-- If C.F. is not suitable then normally one switches to using a
Change Event macro
http://www.mvps.org/dmcritchie/excel/event.htm#case
-- Every time you insert or delete a row, or do a sort you have to
rerun the macro. No comparison to ease of use of C.F.
-- The technique might help those that have sets of rows
for an item and want to conditionally format only say each third row
beginning at the 4th row (first row having descriptions) and would have
difficulty with the limits of C.F. (but that is questionable)
-- You did not DIM all of your variables, anything to do with row numbers
should be LONG and not Integer. (plan for future same for columns)
you have about 5-7 variable that need defining/redefinition.
Would have listed them but could not break into Excel.
-- Tying up computer for ten minutes at 100% CPU is not conducive
to a working solution. Had to kill Excel. So definitely have to
change my calculation back to automatic, and more serious things
I'd rather not mention.
-- Requiring a defined range to go with the macro is an extra burden.

Also the orignal poster should have posted to only one newsgroup
microsoft.public.excel.worksheet.functions would have been fine,
and if you're not sure then one would use microsoft.public.excel.misc
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

"Alex@JPCS" wrote in message .. .
David,
Perhaps yo have missed my point. (I have the full thread, BTW).

In my first post in this thread, I posted a routine called FastColour as an
ALTERNATIVE to Conditional Formatting, since I have found that too much CF
can cause "Out of Memory" problems in a large app.

At the end of the thread, I was hoping that I might attract comment on, or
other subroutine techniques to, the FastColour routine.



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.misc,microsoft.public.excel.programming,comp.apps.spreadsheets
external usenet poster
 
Posts: 634
Default Locking cell color pattern when sorting rows?

Dave, what are you saying - You mean you're *not* a mindreader????????????? <g

--
Regards
Ken.......................


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.misc,microsoft.public.excel.programming,comp.apps.spreadsheets
external usenet poster
 
Posts: 134
Default Locking cell color pattern when sorting rows?

Not even Tom Ogilvy can read minds.
http://google.com/groups?selm=OA%24o...%40cppssbbsa03

BTW, I don't recall memory problems with Conditional Formatting,
almost sounds like applying C.F. to cells individually rather than in big
selections.


"Ken Wright" wrote ...
Dave, what are you saying - You mean you're *not* a mindreader????????????? <g



  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions,microsoft.public.excel.misc,microsoft.public.excel.programming,comp.apps.spreadsheets
external usenet poster
 
Posts: 634
Default Locking cell color pattern when sorting rows?

LOL - Well I'll be........

As for the CF - Just tried it in a single cell, and then copied that cells formats to every cell
on the sheet. No probs and only a 37K file. Would that count as applying to cells singly, as
opposed to selecting the range and then applying the CF one time?

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL2K & XLXP

----------------------------------------------------------------------------
Attitude - A little thing that makes a BIG difference
----------------------------------------------------------------------------



"David McRitchie" wrote in message
...
Not even Tom Ogilvy can read minds.
http://google.com/groups?selm=OA%24o...%40cppssbbsa03

BTW, I don't recall memory problems with Conditional Formatting,
almost sounds like applying C.F. to cells individually rather than in big
selections.


"Ken Wright" wrote ...
Dave, what are you saying - You mean you're *not* a mindreader????????????? <g





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove Pattern Without Affecting Cell Color or Gridlines Filibuster Excel Discussion (Misc queries) 8 May 15th 23 07:42 PM
Cell pattern/color laughing Excel Discussion (Misc queries) 2 December 3rd 07 04:57 PM
Cell color pattern styles in Excel 2007 Candida Excel Discussion (Misc queries) 7 June 18th 07 04:52 PM
cell pattern - color tikchye_oldLearner57 Excel Discussion (Misc queries) 2 April 11th 07 12:28 PM
Date sensitive cell pattern color Darrell Shuman Excel Worksheet Functions 4 August 17th 06 04:26 PM


All times are GMT +1. The time now is 01:52 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"