PC Review


Reply
Thread Tools Rate Thread

Advanced "Conditional" formatting which changes by cell selection

 
 
cosva
Guest
Posts: n/a
 
      23rd Oct 2007
Hi,

I'll try to explain my problem. In column A i can have 5 different
numbers: 1,2,3,4 and 5. So the value of any cell in column A (except
for rows 1,2,3,4,5 - they are heading rows ) can be 1 to 5.
Row 1,2,3,4 and 5 are heading rows.
This is what i would like: when I'm in some row (for example row 34 -
and the value of cell A34 is for example 3), and certain column(lets
say column H), I would like cell H3 to become let's say bold(or change
background color or both) - H3 because when the value in cell A34 is 3
that means that heading row 3 is used and needs to be bolded (but now
the whole row just the cell above my selected cell but in the
appropriate heading row - so if A34 is 1 cell H1 will be bolded and so
on).
I have some knowledge of VB so if I need to use VB here I think i
could manage.
If you have any sugestions it would mean a lot to me!
If you don't understand my problem plese say and I'll try to
explain again

Cheers,

Marko vaco

 
Reply With Quote
 
 
 
 
=?Utf-8?B?U21hbGx3ZWVk?=
Guest
Posts: n/a
 
      23rd Oct 2007
have you tried conditional formatting using a formula rather than value?

"cosva" wrote:

> Hi,
>
> I'll try to explain my problem. In column A i can have 5 different
> numbers: 1,2,3,4 and 5. So the value of any cell in column A (except
> for rows 1,2,3,4,5 - they are heading rows ) can be 1 to 5.
> Row 1,2,3,4 and 5 are heading rows.
> This is what i would like: when I'm in some row (for example row 34 -
> and the value of cell A34 is for example 3), and certain column(lets
> say column H), I would like cell H3 to become let's say bold(or change
> background color or both) - H3 because when the value in cell A34 is 3
> that means that heading row 3 is used and needs to be bolded (but now
> the whole row just the cell above my selected cell but in the
> appropriate heading row - so if A34 is 1 cell H1 will be bolded and so
> on).
> I have some knowledge of VB so if I need to use VB here I think i
> could manage.
> If you have any sugestions it would mean a lot to me!
> If you don't understand my problem plese say and I'll try to
> explain again
>
> Cheers,
>
> Marko vaco
>
>

 
Reply With Quote
 
cosva
Guest
Posts: n/a
 
      23rd Oct 2007
On 23 list, 17:26, Smallweed <Smallw...@discussions.microsoft.com>
wrote:
> have you tried conditional formatting using a formula rather than value?
>
> "cosva" wrote:
> > Hi,

>
> > I'll try to explain my problem. In column A i can have 5 different
> > numbers: 1,2,3,4 and 5. So the value of any cell in column A (except
> > for rows 1,2,3,4,5 - they are heading rows ) can be 1 to 5.
> > Row 1,2,3,4 and 5 are heading rows.
> > This is what i would like: when I'm in some row (for example row 34 -
> > and the value of cell A34 is for example 3), and certain column(lets
> > say column H), I would like cell H3 to become let's say bold(or change
> > background color or both) - H3 because when the value in cell A34 is 3
> > that means that heading row 3 is used and needs to be bolded (but now
> > the whole row just the cell above my selected cell but in the
> > appropriate heading row - so if A34 is 1 cell H1 will be bolded and so
> > on).
> > I have some knowledge of VB so if I need to use VB here I think i
> > could manage.
> > If you have any sugestions it would mean a lot to me!
> > If you don't understand my problem plese say and I'll try to
> > explain again

>
> > Cheers,

>
> > Marko vaco


I don't know how to start!!
Any idea?

Marko Svaco

 
Reply With Quote
 
cosva
Guest
Posts: n/a
 
      23rd Oct 2007
On 23 list, 19:12, cosva <mark...@gmail.com> wrote:
> On 23 list, 17:26, Smallweed <Smallw...@discussions.microsoft.com>
> wrote:
>
>
>
> > have you tried conditional formatting using a formula rather than value?

>
> > "cosva" wrote:
> > > Hi,

>
> > > I'll try to explain my problem. In column A i can have 5 different
> > > numbers: 1,2,3,4 and 5. So the value of any cell in column A (except
> > > for rows 1,2,3,4,5 - they are heading rows ) can be 1 to 5.
> > > Row 1,2,3,4 and 5 are heading rows.
> > > This is what i would like: when I'm in some row (for example row 34 -
> > > and the value of cell A34 is for example 3), and certain column(lets
> > > say column H), I would like cell H3 to become let's say bold(or change
> > > background color or both) - H3 because when the value in cell A34 is 3
> > > that means that heading row 3 is used and needs to be bolded (but now
> > > the whole row just the cell above my selected cell but in the
> > > appropriate heading row - so if A34 is 1 cell H1 will be bolded and so
> > > on).
> > > I have some knowledge of VB so if I need to use VB here I think i
> > > could manage.
> > > If you have any sugestions it would mean a lot to me!
> > > If you don't understand my problem plese say and I'll try to
> > > explain again

>
> > > Cheers,

>
> > > Marko vaco

>
> I don't know how to start!!
> Any idea?
>
> Marko Svaco


And conditional formatting works with 3 conditions? I need five
conditions.

 
Reply With Quote
 
Andrew Taylor
Guest
Posts: n/a
 
      24th Oct 2007
On Oct 23, 6:14 pm, cosva <mark...@gmail.com> wrote:
> On 23 list, 19:12, cosva <mark...@gmail.com> wrote:
>
> > On 23 list, 17:26, Smallweed <Smallw...@discussions.microsoft.com>
> > wrote:

>
> > > have you tried conditional formatting using a formula rather than value?

>
> > > "cosva" wrote:
> > > > Hi,

>
> > > > I'll try to explain my problem. In column A i can have 5 different
> > > > numbers: 1,2,3,4 and 5. So the value of any cell in column A (except
> > > > for rows 1,2,3,4,5 - they are heading rows ) can be 1 to 5.
> > > > Row 1,2,3,4 and 5 are heading rows.
> > > > This is what i would like: when I'm in some row (for example row 34 -
> > > > and the value of cell A34 is for example 3), and certain column(lets
> > > > say column H), I would like cell H3 to become let's say bold(or change
> > > > background color or both) - H3 because when the value in cell A34 is 3
> > > > that means that heading row 3 is used and needs to be bolded (but now
> > > > the whole row just the cell above my selected cell but in the
> > > > appropriate heading row - so if A34 is 1 cell H1 will be bolded and so
> > > > on).
> > > > I have some knowledge of VB so if I need to use VB here I think i
> > > > could manage.
> > > > If you have any sugestions it would mean a lot to me!
> > > > If you don't understand my problem plese say and I'll try to
> > > > explain again

>
> > > > Cheers,

>
> > > > Marko vaco

>
> > I don't know how to start!!
> > Any idea?

>
> > Marko Svaco

>
> And conditional formatting works with 3 conditions? I need five
> conditions.-


If I understand you correctly you don't need 5 conditions; you need
one condition in each of cells H1 to H2, i.e.

H1: bold if column A of currently selected row = 1, normal otherwise
H2: bold if column A of currently selected row = 2, normal otherwise
etc.


To do that you could use conditional formatting using the formula
option. There are two problems about this (both qualified by "as
far as I know"):

1. There is no worksheet function to tell you anything about what the
current selection is, or what it contains. To get round this you can
write a UDF: (beware word-wrap)

Public Function ValueInSelectionColumnA()

Application.Volatile ' force recalc even if VBA thinks it's not
needed

On Error Resume Next ' avoid error if Selection is not a range of
cells

ValueInSelectionColumnA = ActiveSheet.Cells(Selection.Cells(1,
1).Row, 1).Value

On Error GoTo 0

End Function

Then in H1 to H5 set up Conditional Formatting with a formula of
=ValueInSelectionColumnA()=ROW() , format Bold

This sort of works, but the formatting only works when you
recalculate, not if you just move
around the sheet (Problem 2). To get round that you need to use the
SelectionChange
event for the worksheet:


Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iRow As Integer
For iRow = 1 To 5
ActiveSheet.Cells(iRow, "H").Formula = ActiveSheet.Cells(iRow,
"H").Formula ' force recalc
Next
End Sub


Doing all this seems to achieve what I think you want - I hope it
makes some sense

Andrew











 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add "left align across selection" cell formatting =?Utf-8?B?TW9udHkgQW5hbHlzdA==?= Microsoft Excel Worksheet Functions 3 28th Sep 2010 05:35 PM
"justify across selection" cell formatting dgold82 Microsoft Excel Misc 6 30th Jun 2009 09:02 PM
Conditional formatting based off cell with text? (i.e. "less than80%") velasquez.m@gmail.com Microsoft Excel Discussion 2 13th Feb 2008 06:56 PM
conditional formatting "if part of cell contents contains string" =?Utf-8?B?dG9tIG9zc2lldXI=?= Microsoft Excel Worksheet Functions 1 13th Mar 2007 11:11 AM
Formatting long lines using "Edit->Advanced->Format Selection" Kyle Blaney Microsoft C# .NET 0 4th Feb 2004 03:58 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:19 AM.