Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
iwl iwl is offline
external usenet poster
 
Posts: 6
Default Excel VBA Bug

Hi Group,

can somebody verify the follow bug

Public Function test() As String
ActiveSheet.Range("$P$04:$P$216") = Null
test = ActiveSheet.Range("$A$1").Address
End Function

calling this function in a cell =test()
I get #WERT (German Excel, I think #VALUE
in English as result)

comenting first call out
'ActiveSheet.Range("$P$04:$P$216") = Null

I get $A$1 as expected
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Excel VBA Bug

It is not a bug, you just cannot change part of a worksheet from within a
VBA function called in a worksheet formula.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"iwl" wrote in message
...
Hi Group,

can somebody verify the follow bug

Public Function test() As String
ActiveSheet.Range("$P$04:$P$216") = Null
test = ActiveSheet.Range("$A$1").Address
End Function

calling this function in a cell =test()
I get #WERT (German Excel, I think #VALUE
in English as result)

comenting first call out
'ActiveSheet.Range("$P$04:$P$216") = Null

I get $A$1 as expected



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default Excel VBA Bug

A UDF can not modify any cell that it is not in. It is a function in the
truest sense in that it just returns a value. A function called from within
code can modify what it wants, but not a UDF.

--
HTH...

Jim Thomlinson


"iwl" wrote:

Hi Group,

can somebody verify the follow bug

Public Function test() As String
ActiveSheet.Range("$P$04:$P$216") = Null
test = ActiveSheet.Range("$A$1").Address
End Function

calling this function in a cell =test()
I get #WERT (German Excel, I think #VALUE
in English as result)

comenting first call out
'ActiveSheet.Range("$P$04:$P$216") = Null

I get $A$1 as expected

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



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