Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / August 2006

Tip: Looking for answers? Try searching our database.

Over keying a formula - Can I set this to automatically bold ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dave - 16 Aug 2006 16:16 GMT
Hi All,

Hopefully this is a nice easy one that somebody can help me out with :-)

I have a column of data with formula's in (forecasted sales) during the
month I over key these when the actual orders come in. Is there a way that I
can set something up so that when I over key the formula the text changes in
some way either a different colour or bold for example. I have tried using
conditional formatting but don't seem to be getting anywhere.

Thanks in advance for your help

Regards

Dave
Bernie Deitrick - 16 Aug 2006 17:14 GMT
Dave,

You need to use an event.

Copy the code below, right-click your sheet tab, select "View Code" and paste the code into the
window that appears.

This code will make cells with formulas that have been over-written bold and red.

HTH,
Bernie
MS Excel MVP

Private Sub Worksheet_Change(ByVal Target As Range)
Dim NewVal As Variant
With Application
  .EnableEvents = False
  NewVal = Target.Value
  .Undo
  If Target.HasFormula Then
       Target.Font.Bold = True
       Target.Font.ColorIndex = 3
   End If
  Target.Value = NewVal
  .EnableEvents = True
End With
End Sub

> Hi All,
>
[quoted text clipped - 11 lines]
>
> Dave
Gord Dibben - 17 Aug 2006 00:58 GMT
You can add this User Defined Function to your workbook.

Function IsFormula(Cell)
   Application.Volatile
   IsFormula = Cell.HasFormula
End Function

Select the range to Format then

Format>Conditional Formatting>Formula is:  =isformula($A1)

I assumed the range was in column A.

Gord Dibben  MS Excel MVP

>Hi All,
>
[quoted text clipped - 11 lines]
>
>Dave
Dave - 17 Aug 2006 15:09 GMT
Thanks for that Bernie,

It does exactly what I want, a couple of things though.......:-)
It appears to have disabled my undo button, I can't seem to undo any of my
often keying errors and if I try to recopy the formula back in to the cell
after I have over keyed, it doesn't put the formula back in only the value of
what the formula would be. I've tried taking the event back out and things go
back to normal

Any suggestions?

Thanks again

Dave

> Hi All,
>
[quoted text clipped - 11 lines]
>
> Dave
Bernie Deitrick - 17 Aug 2006 15:38 GMT
Dave,

Sorry, but running event code will dump Excel's memory stack, prevent Undo.

Try Gord's solution of using the UDF in the Cond. Formatting.

HTH,
Bernie
MS Excel MVP

> Thanks for that Bernie,
>
[quoted text clipped - 26 lines]
>>
>> Dave
Dave - 17 Aug 2006 16:10 GMT
Thanks Bernie,

How do I add a user defined function? Do I just copy the code into the view
code window as per your suggestion ?

Regards

Dave

> Dave,
>
[quoted text clipped - 36 lines]
> >>
> >> Dave
Bernie Deitrick - 17 Aug 2006 17:21 GMT
Dave,

No. You need to put it into a standard codemodule.  See

http://www.mvps.org/dmcritchie/excel/getstarted.htm

for more detailed instructions.

HTH,
Bernie
MS Excel MVP

> Thanks Bernie,
>
[quoted text clipped - 45 lines]
>> >>
>> >> Dave
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.