Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default function formatting a cell

Suppose I have a value in A1 and the formula
=FormatCell(A1), calling the following macro, in B1

Function FormatCell(a As Range)
a.Cells(1, 1).Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 3
End Function

Why I hav'nt A1 formatted?
I have breakpointed the macro and it triggers when I change the A1
value.

Bye, Emiliano
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default function formatting a cell

A UDF cannot directly change the format of a cell.
--
Gary''s Student - gsnu2007a


"papero" wrote:

Suppose I have a value in A1 and the formula
=FormatCell(A1), calling the following macro, in B1

Function FormatCell(a As Range)
a.Cells(1, 1).Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 3
End Function

Why I hav'nt A1 formatted?
I have breakpointed the macro and it triggers when I change the A1
value.

Bye, Emiliano

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 29
Default function formatting a cell

Thanks, any advice to get it?
I used the UDF since I've to manage complex conditions.

Emiliano

"Gary''s Student" ha scritto nel
messaggio ...
A UDF cannot directly change the format of a cell.
--
Gary''s Student - gsnu2007a


"papero" wrote:

Suppose I have a value in A1 and the formula
=FormatCell(A1), calling the following macro, in B1

Function FormatCell(a As Range)
a.Cells(1, 1).Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 3
End Function

Why I hav'nt A1 formatted?
I have breakpointed the macro and it triggers when I change the A1
value.

Bye, Emiliano




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default function formatting a cell

Two approaches:

1. Use the UDF, (or something like it) to set a Conditional Format.
2. Put the UDF or related UDF in a worksheet cell and use a Calculate Event
Macro to paint formats based upon the value returned.
--
Gary''s Student - gsnu2007a


"eggpap" wrote:

Thanks, any advice to get it?
I used the UDF since I've to manage complex conditions.

Emiliano

"Gary''s Student" ha scritto nel
messaggio ...
A UDF cannot directly change the format of a cell.
--
Gary''s Student - gsnu2007a


"papero" wrote:

Suppose I have a value in A1 and the formula
=FormatCell(A1), calling the following macro, in B1

Function FormatCell(a As Range)
a.Cells(1, 1).Select
Selection.Font.Bold = True
Selection.Font.ColorIndex = 3
End Function

Why I hav'nt A1 formatted?
I have breakpointed the macro and it triggers when I change the A1
value.

Bye, Emiliano





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
use formatting from source cell in CONCATENATE function zacarab Excel Worksheet Functions 1 September 18th 06 11:25 PM
formatting a cell with a function (IF statement) Dreaming Excel Worksheet Functions 3 June 30th 05 02:26 AM
Formatting a cell with a function (IF statement) Dreaming Excel Worksheet Functions 2 June 30th 05 02:12 AM
Changing cell formatting with IF function Bruise Excel Worksheet Functions 6 May 21st 05 11:40 PM
How can I use an IF function to look for specific cell formatting. Tim Excel Worksheet Functions 1 November 15th 04 01:09 PM


All times are GMT +1. The time now is 10:50 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"