ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Conditional Formats for formulae and values (https://www.excelbanter.com/excel-worksheet-functions/125076-conditional-formats-formulae-values.html)

GrahamB

Conditional Formats for formulae and values
 
Cell A5 contains a formula with that cell unlocked. The formula gives a
prompt to the user who can then either accept the forluma's 'suggestion' or
overtype that formula with a value. The default font format is Arial 10 with
half scale grey. If the user chooses to overtype that formula, I want the
result to show as bold and black (or automatic). The sheet will then
effectively highlight (in bold) those cells where the formula has been
overtyped. (I don't think it makes a difference but A5 default format is
custom 'hh:mm').
I've tried all types or conditional formatting but cannot get the correct
result !
GrahamB



Gary''s Student

Conditional Formats for formulae and values
 
Hi Graham:

Paste the following macro into Worksheet code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A5")) Is Nothing Then
Exit Sub
End If
With Range("A5")
If .HasFormula Then
Exit Sub
End If
.ClearFormats
.Font.FontStyle = "bold"
.Font.ColorIndex = xlAutomatic
End With
End Sub

If you are not familiar with VBA, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm
--
Gary's Student


"GrahamB" wrote:

Cell A5 contains a formula with that cell unlocked. The formula gives a
prompt to the user who can then either accept the forluma's 'suggestion' or
overtype that formula with a value. The default font format is Arial 10 with
half scale grey. If the user chooses to overtype that formula, I want the
result to show as bold and black (or automatic). The sheet will then
effectively highlight (in bold) those cells where the formula has been
overtyped. (I don't think it makes a difference but A5 default format is
custom 'hh:mm').
I've tried all types or conditional formatting but cannot get the correct
result !
GrahamB




GrahamB

Conditional Formats for formulae and values
 
Hello "Gary's Student",
Many thanks for your reply; although fairly new to this, i am always
surprised (and grateful) that experts like you spend thier time and effort
helping newbies. It may be some days before i can re-post as I have some
reading to do (!) but many thanks, i will respond in due course.
GrahamB

"Gary''s Student" wrote in message
...
Hi Graham:

Paste the following macro into Worksheet code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A5")) Is Nothing Then
Exit Sub
End If
With Range("A5")
If .HasFormula Then
Exit Sub
End If
.ClearFormats
.Font.FontStyle = "bold"
.Font.ColorIndex = xlAutomatic
End With
End Sub

If you are not familiar with VBA, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm
--
Gary's Student


"GrahamB" wrote:

Cell A5 contains a formula with that cell unlocked. The formula gives a
prompt to the user who can then either accept the forluma's 'suggestion'
or
overtype that formula with a value. The default font format is Arial 10
with
half scale grey. If the user chooses to overtype that formula, I want the
result to show as bold and black (or automatic). The sheet will then
effectively highlight (in bold) those cells where the formula has been
overtyped. (I don't think it makes a difference but A5 default format is
custom 'hh:mm').
I've tried all types or conditional formatting but cannot get the correct
result !
GrahamB






GrahamB

Conditional Formats for formulae and values
 
Hi "Gary's Student",
Many thanks for your help. I pasted your code into the Worksheet (after
right clicking on sheet tab and then 'View Code'). The problem that occurred
is that the format changed to either general or number, and the expected
result of One hour as a Bold and Centred '01:00' appeared as
'0.0416666666666667'. I've tried recording a Macro to change the format to
custom time and then pasting it into your code but my knowledge it too poor
to get it to work. Any help would be appreciated !
Cheers
GrahamB

"Gary''s Student" wrote in message
...
Hi Graham:

Paste the following macro into Worksheet code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A5")) Is Nothing Then
Exit Sub
End If
With Range("A5")
If .HasFormula Then
Exit Sub
End If
.ClearFormats
.Font.FontStyle = "bold"
.Font.ColorIndex = xlAutomatic
End With
End Sub

If you are not familiar with VBA, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm
--
Gary's Student


"GrahamB" wrote:

Cell A5 contains a formula with that cell unlocked. The formula gives a
prompt to the user who can then either accept the forluma's 'suggestion'
or
overtype that formula with a value. The default font format is Arial 10
with
half scale grey. If the user chooses to overtype that formula, I want the
result to show as bold and black (or automatic). The sheet will then
effectively highlight (in bold) those cells where the formula has been
overtyped. (I don't think it makes a difference but A5 default format is
custom 'hh:mm').
I've tried all types or conditional formatting but cannot get the correct
result !
GrahamB






Gary''s Student

Conditional Formats for formulae and values
 
I will update this post tomorrow.
--
Gary's Student
gsnu200701


"GrahamB" wrote:

Hi "Gary's Student",
Many thanks for your help. I pasted your code into the Worksheet (after
right clicking on sheet tab and then 'View Code'). The problem that occurred
is that the format changed to either general or number, and the expected
result of One hour as a Bold and Centred '01:00' appeared as
'0.0416666666666667'. I've tried recording a Macro to change the format to
custom time and then pasting it into your code but my knowledge it too poor
to get it to work. Any help would be appreciated !
Cheers
GrahamB

"Gary''s Student" wrote in message
...
Hi Graham:

Paste the following macro into Worksheet code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A5")) Is Nothing Then
Exit Sub
End If
With Range("A5")
If .HasFormula Then
Exit Sub
End If
.ClearFormats
.Font.FontStyle = "bold"
.Font.ColorIndex = xlAutomatic
End With
End Sub

If you are not familiar with VBA, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm
--
Gary's Student


"GrahamB" wrote:

Cell A5 contains a formula with that cell unlocked. The formula gives a
prompt to the user who can then either accept the forluma's 'suggestion'
or
overtype that formula with a value. The default font format is Arial 10
with
half scale grey. If the user chooses to overtype that formula, I want the
result to show as bold and black (or automatic). The sheet will then
effectively highlight (in bold) those cells where the formula has been
overtyped. (I don't think it makes a difference but A5 default format is
custom 'hh:mm').
I've tried all types or conditional formatting but cannot get the correct
result !
GrahamB







Gary''s Student

Conditional Formats for formulae and values
 
Hi Graham:

Here is the updated code:

Private Sub Worksheet_Change(ByVal Target As Range)
'''''''''''''''''''''''''''''''''''''''''''
'
' version 2
'
''''''''''''''''''''''''''''''''''''''''''''
If Intersect(Target, Range("A5")) Is Nothing Then
Exit Sub
End If
With Range("A5")
If .HasFormula Then
Exit Sub
End If
.Font.FontStyle = "bold"
.Font.ColorIndex = xlAutomatic
End With
End Sub

The only necessary change was to remove the clear formats statement in the
original version.

Have a pleasant day!
--
Gary's Student
gsnu200701


"GrahamB" wrote:

Hi "Gary's Student",
Many thanks for your help. I pasted your code into the Worksheet (after
right clicking on sheet tab and then 'View Code'). The problem that occurred
is that the format changed to either general or number, and the expected
result of One hour as a Bold and Centred '01:00' appeared as
'0.0416666666666667'. I've tried recording a Macro to change the format to
custom time and then pasting it into your code but my knowledge it too poor
to get it to work. Any help would be appreciated !
Cheers
GrahamB

"Gary''s Student" wrote in message
...
Hi Graham:

Paste the following macro into Worksheet code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A5")) Is Nothing Then
Exit Sub
End If
With Range("A5")
If .HasFormula Then
Exit Sub
End If
.ClearFormats
.Font.FontStyle = "bold"
.Font.ColorIndex = xlAutomatic
End With
End Sub

If you are not familiar with VBA, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm
--
Gary's Student


"GrahamB" wrote:

Cell A5 contains a formula with that cell unlocked. The formula gives a
prompt to the user who can then either accept the forluma's 'suggestion'
or
overtype that formula with a value. The default font format is Arial 10
with
half scale grey. If the user chooses to overtype that formula, I want the
result to show as bold and black (or automatic). The sheet will then
effectively highlight (in bold) those cells where the formula has been
overtyped. (I don't think it makes a difference but A5 default format is
custom 'hh:mm').
I've tried all types or conditional formatting but cannot get the correct
result !
GrahamB








All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com