Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Conditional Formating Bug when using HasFormula UDF

Something strange is happening in Excel 2003 SP2.
I am using this udf to Conditional Format a cell on Sheet2
Function cf_NotFormula(cell)
'based on http://www.mvps.org/dmcritchie/excel...htm#HasFormula
cf_NotFormula = Not cell.HasFormula And Not IsEmpty(cell) _
And Not cell.Row = 1
End Function

When I go to Sheet1 cell A1 and type in "=" and then point to cell A2 on
Sheet2 (to hopefully create =Sheet2!A2 in cell A1 on Sheet1) and then press
ENTER something very strange happens. Sheet2 remains in view and a spurious
entry materialises in Cell A1 on Sheet2 (usually). I've got a small test
model available if you want try it for yourself.

I have narrowed the problem down to the .HasFormula property.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Conditional Formating Bug when using HasFormula UDF

I have now come up with a workaround:

Public Function HasFormula(rngCell As Range) As Boolean
'NB rngCell.HasFormula causes problesm with Conditional formating.
On Error Resume Next
If Left$(rngCell.Formula, 1) = "=" Then
HasFormula = True
End If
End Function


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
simple... HasFormula ? mark kubicki Excel Programming 5 May 11th 06 04:01 PM
Help with ActiveCell.HasFormula Paul Fenton[_2_] Excel Programming 0 April 20th 06 03:03 PM
HasFormula John Wirt[_12_] Excel Programming 1 February 7th 06 04:07 AM
Install dates formating using conditional formating? Jerry Eggleston Excel Discussion (Misc queries) 2 November 9th 05 05:49 PM
HasFormula protect cell SIGE Excel Programming 7 May 19th 05 05:24 PM


All times are GMT +1. The time now is 01:10 AM.

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

About Us

"It's about Microsoft Excel"