Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Formatting a cell calculated by a VBA function

Hi, I am writing some xtra functions for excel, and am wanting to
return formatting with the result.

An example might be creating a NextBusinessDay(Today As Date) function
that returns the next business day after the date supplied. I can
write the code to return the value. but i would also like to apply
formatting to the cell.

So for example if the day is a Friday, color it red.


It cells in the excel spreadsheet that use the function would just
have a value like =NextBusinessDay('07/01/2005')

Is it possible to return formatting directly from the VBA function. or
is there a way to tell from the VBA functions which cell has called
it.

Thanks
Andy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Formatting a cell calculated by a VBA function

Hi Andy,

A worksheet function can only return a value to the the calling cell it
cannot apply formatting.

BTW, for your NextBusinessDay function, you can use the Workday function if
you have the Analysis ToolPak loaded.

For your format problem, perhaps you could use conditional formatting?

---
Regards,
Norman



"Andy" wrote in message
m...
Hi, I am writing some xtra functions for excel, and am wanting to
return formatting with the result.

An example might be creating a NextBusinessDay(Today As Date) function
that returns the next business day after the date supplied. I can
write the code to return the value. but i would also like to apply
formatting to the cell.

So for example if the day is a Friday, color it red.


It cells in the excel spreadsheet that use the function would just
have a value like =NextBusinessDay('07/01/2005')

Is it possible to return formatting directly from the VBA function. or
is there a way to tell from the VBA functions which cell has called
it.

Thanks
Andy



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
Pivot table, IF function, calculated item versus calculated field NomadPurple Excel Discussion (Misc queries) 1 March 9th 10 03:17 PM
Copying formatting from a cell whose location I have calculated. sdm New Users to Excel 4 September 8th 08 08:40 PM
Formatting a calculated value in a cell Tim Excel Discussion (Misc queries) 5 November 28th 07 10:04 PM
How do I insert a calculated cell range into an excel function Gary Wallis Excel Worksheet Functions 2 April 26th 07 03:28 PM
Formatting numbers in each cell after I have calculated their valu Davidr004 Excel Worksheet Functions 1 April 10th 07 06:46 PM


All times are GMT +1. The time now is 06:08 PM.

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

About Us

"It's about Microsoft Excel"