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 |
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 |
All times are GMT +1. The time now is 05:56 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com