Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default "Out of Context" Message?

When I execute the following line of VB Macro code
ActiveSheet.Cells(2,1) = "Hi"

the computer seems to stop processing and all the variables I am watching in
the
"Watches" Screen have their Value change to "<Out of Context.

Anyone know what's going on? I'm kind of at my wit's end trying to figure
this one out. "Out of context" is not even defined in their help file or
Knowledge Base.

Thanks,
Capt Mac


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default "Out of Context" Message?

I can't replicate the problem. Can you post the rest of your code and
identify the variables of interest?

"Out of context" generally means that the variable has gone out of scope.

--

Vasant

"Mac Lingo" wrote in message
nk.net...
When I execute the following line of VB Macro code
ActiveSheet.Cells(2,1) = "Hi"

the computer seems to stop processing and all the variables I am watching

in
the
"Watches" Screen have their Value change to "<Out of Context.

Anyone know what's going on? I'm kind of at my wit's end trying to figure
this one out. "Out of context" is not even defined in their help file or
Knowledge Base.

Thanks,
Capt Mac




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default "Out of Context" Message? - The rest of the code

Function A(ARG)
i = 1
ActiveSheet.Cells(2, 1) = "Hi"
i = 2
End Function

The Execution of the "ActiveSheet...." line is the point that the values (of
I in the Watch window become "Out of context".

Thanks,
Mac


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default "Out of Context" Message? - The rest of the code

Perhaps you are calling the function from the worksheet, in which case it
fails on the second line.

A worksheet function cannot make any changes to the worksheet; it can only
return a value to the calling cell.

--

Vasant



"Mac Lingo" wrote in message
nk.net...
Function A(ARG)
i = 1
ActiveSheet.Cells(2, 1) = "Hi"
i = 2
End Function

The Execution of the "ActiveSheet...." line is the point that the values

(of
I in the Watch window become "Out of context".

Thanks,
Mac




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 53
Default "Out of Context" Message?

Missing Information from the Problem - The VB Macro is calle as a FUNCTION
being
called from the spreadsheet.

The Solution: - A Rule: You CAN'T change the enviornment a Function is being
called from. I suppose this is because it too easily can end up in an
infinite loop, but for whatever reason EXCEL won't allow it.

Answer: You have to write a SUBROUTINE instead.



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
"excel "macros may be disabled" message using an xlam file frustrated Excel Worksheet Functions 2 July 13th 09 08:32 PM
"Edit Query" back into context menu? Bobby Excel Discussion (Misc queries) 1 February 3rd 09 08:36 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM


All times are GMT +1. The time now is 02:47 AM.

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"