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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|