A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Referencing a cell's format



 
 
Thread Tools Display Modes
  #1  
Old February 17th, 2004, 05:33 PM
Frank Kabel
external usenet poster
 
Posts: n/a
Default Referencing a cell's format

Hi
formulas can only return values. So no way to link formats with
formulas between two cells

--
Regards
Frank Kabel
Frankfurt, Germany

Charlie_Brown wrote:
I have a sheet that is referencing another.
Is there a way of referencing a cell's value AND it's format (bold,
borders etc..)


  #2  
Old February 17th, 2004, 05:42 PM
Ron Rosenfeld
external usenet poster
 
Posts: n/a
Default Referencing a cell's format

On Tue, 17 Feb 2004 09:26:05 -0800, "Charlie_Brown"
wrote:

I have a sheet that is referencing another.
Is there a way of referencing a cell's value AND it's format (bold, borders etc..)


You can do that with a VBA User Defined Function.

For example, here is one UDF that returns TRUE if the referenced cell(s) are
formatted "italic" and FALSE if not:

=====================
Function IsItalic(rg As Range) As Variant
Application.Volatile
Dim c As Range, i As Integer, j As Integer
Dim N()

i = 0
For Each c In rg
i = i + 1
Next c
ReDim N(i - 1)

j = 0
For Each c In rg
N(j) = c.Font.Italic
j = j + 1
Next c

IsItalic = N
End Function
====================

One caveat: Changing the format of a cell does NOT trigger recalculation. So
when you change a format, you will not see the result of this UDF change until
something causes the sheet to recalculate.


--ron
 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 04:11 PM.


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