Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default to modify cells from a function

When I use the following code from a macro call on the menu of Excel it
works fine (changes the format of the top leftmost cells of the sheet but
when I execute it from a function that is used in a cell of the sheet it
does not work.
How can I change the format or content of cells in a spreadsheet from within
a vusual basic function called in a cell ?
_______________________________________________

Sub upc()

Dim myCell As Range
Set myCell = Worksheets("Feuil1").Range("A1:C1")
With myCell.Font
.Bold = True
.Italic = True
End With

End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default to modify cells from a function

You can't. That is not allowed by Excel.

A function used in a cell can only return a value to the cell - it can't
change the "environment".

http://support.microsoft.com/default...b;en-us;170787
XL: Custom Functions Can't Change Microsoft Excel Environment

Regards,
Tom Ogilvy

"Pierre Laporte" wrote in message
.. .
When I use the following code from a macro call on the menu of Excel it
works fine (changes the format of the top leftmost cells of the sheet but
when I execute it from a function that is used in a cell of the sheet it
does not work.
How can I change the format or content of cells in a spreadsheet from

within
a vusual basic function called in a cell ?
_______________________________________________

Sub upc()

Dim myCell As Range
Set myCell = Worksheets("Feuil1").Range("A1:C1")
With myCell.Font
.Bold = True
.Italic = True
End With

End Sub




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
Modify search function Dinesh Excel Worksheet Functions 3 March 18th 09 02:26 AM
Modify array function length Fabian Grodek Excel Worksheet Functions 3 August 8th 06 04:45 PM
Is there a way to modify the DAYS360 function to accomadate a 365 Linda Miller Excel Worksheet Functions 2 August 2nd 06 08:16 PM
How do I modify the autofit function in Excel? NadineWoj Excel Discussion (Misc queries) 2 February 22nd 06 10:25 PM
Can I modify a Hyperlink with a function? barrfly Excel Discussion (Misc queries) 7 June 2nd 05 12:03 AM


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