Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel macro problem on 'value' method

Hi,

Any help with this will be greatly appreciated - I am at a total loss.

Here is the macro code:

Public Function go() As String
Range("B1").Value = "test"
End Function

All very simple - yes?

When this function is called from a cell formula (e.g. set A1 to
'=go()') the result is as follows:

B1 is #VALUE!
A1 is blank (as it was prior to the formula being entered)

Having debugged the macro it is the RANGE line that throws an error.

If I run that same line in the immediate window it works fine.

I am running Excel 2002 in XP and thought it might be something to do
with security etc. But I've played around with that and got nowhere.

I am suspecting something is wrong with the Microsoft playform I have,
and not something general - as it is quite a fundamental cock up in
functionality.

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 52
Default Excel macro problem on 'value' method

Worksheet functions (called from a worksheet cell)--built into excel and created
by you--can't change a different cell.

They can return a value back to the cell that holds the function.

You may be able to use an event macro that can do whatever macros can do in its
place.



merecat_ wrote:

Hi,

Any help with this will be greatly appreciated - I am at a total loss.

Here is the macro code:

Public Function go() As String
Range("B1").Value = "test"
End Function

All very simple - yes?

When this function is called from a cell formula (e.g. set A1 to
'=go()') the result is as follows:

B1 is #VALUE!
A1 is blank (as it was prior to the formula being entered)

Having debugged the macro it is the RANGE line that throws an error.

If I run that same line in the immediate window it works fine.

I am running Excel 2002 in XP and thought it might be something to do
with security etc. But I've played around with that and got nowhere.

I am suspecting something is wrong with the Microsoft playform I have,
and not something general - as it is quite a fundamental cock up in
functionality.

Thanks.


--

Dave Peterson

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
Problem using SaveAs method Sujata Excel Discussion (Misc queries) 4 March 30th 10 07:21 AM
Find Method problem in Excel VBA.... Irmann Excel Worksheet Functions 7 March 10th 08 03:49 AM
Problem is using any method of Range Object Shilps[_2_] Excel Programming 3 October 29th 04 06:24 AM
Proper method for Excel/Query/Macro reporting Laphan[_2_] Excel Programming 1 October 30th 03 12:59 PM


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