LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Assigning cell values within a VBA program

Chris

a Function can only return a value to the cell it is in; it cannot affect
another cell or the Excel environment.

Regards

Trevor


"Chris Burrows" wrote in message
...
Why doesn't this function work?

Function Zemax()
Worksheets("Sheet1").Range("A1").Formula = "=2+2"
Zemax = 3
End Function

If I execute it within the IDE using F5, I get cell A1 set correctly.
If I comment out the second line, and call it as a function reference

within the spreadsheet it sets the current cell to 3.
If I don't comment it out, it doesn't set cell A1, and returns a #VALUE

error.

What gives?????



 
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
Assigning cell values to variables Tim Excel Discussion (Misc queries) 3 June 11th 09 04:30 PM
Assigning cell values to return a number whatzzup Excel Discussion (Misc queries) 1 March 20th 06 03:07 PM
Assigning cell values to return a number wdjsxj Excel Discussion (Misc queries) 0 March 20th 06 02:55 PM
Program for assigning work shift hours frankiee Excel Discussion (Misc queries) 1 March 10th 06 02:54 AM


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