View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
[email protected] ajharvey@gmail.com is offline
external usenet poster
 
Posts: 1
Default Formatting a cell calculated by a VBA function

Hi

Is it also true, that you cannot change the format of any Cell within a
macro if the macro is run during the calculation of a cell?

In testing I have the following function

Function Format() As String
Range("A1").Font.Bold = True
Format = "Done"
End Function

Then i set Cell B1 to equal =Format() which runs the function, I can
break execution in the function and execute the Bold = True line, but
in the watch window the Property stays false.

However if i run the function from a button or by just running the
macro, the line works and changes the cell text to bold.

Seems to me that the contents and formatting of the worksheet is locked
and readonly while Excel is calculating a cell.
Is this true?

Thanks
Andy