Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How to avoid error 2015 when using ActiveCell.Offsett in own function

Hi
I have this simple test function that I'm using in order to learn how to use
Offset:
Code:
Option Explicit
Option Base 1
Public Function PT_Flash(P As Double, T As Double) As Double
Dim PT_Value As Double
ActiveCell.Offset(10, 10).Value = "test me"
'the line above gives a error.
PT_Value = P * T
PT_Flash = PT_Value
End Function

But no matter what I have tryed I cannot get the line with
"ActiveCell.Offset" to work, is allways give me error 2015
Any hint to as how to use ActiveCell.Offset?

Thanks Torben



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 27/01/2004


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How to avoid error 2015 when using ActiveCell.Offsett in own function

Are you calling this function from a worksheet cell? If so, it
won't work. A function called from a worksheet cell cannot change
the Excel environment in any way, including changing the values
of other cells.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Torben Laursen" wrote in message
...
Hi
I have this simple test function that I'm using in order to

learn how to use
Offset:
Code:
Option Explicit
Option Base 1
Public Function PT_Flash(P As Double, T As Double) As Double
Dim PT_Value As Double
ActiveCell.Offset(10, 10).Value = "test me"
'the line above gives a error.
PT_Value = P * T
PT_Flash = PT_Value
End Function

But no matter what I have tryed I cannot get the line with
"ActiveCell.Offset" to work, is allways give me error 2015
Any hint to as how to use ActiveCell.Offset?

Thanks Torben



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date:

27/01/2004




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How to avoid error 2015 when using ActiveCell.Offsett in own function

Hi Chip

Yes I am.
But if can not do that how can I return a number of values from the function
call to the sheet?

What I want is for the user to call a function in a number of cells in a
columen and then return a range of information in each row next to the cell
that is calling the function

Thanks Torben

"Chip Pearson" wrote in message
...
Are you calling this function from a worksheet cell? If so, it
won't work. A function called from a worksheet cell cannot change
the Excel environment in any way, including changing the values
of other cells.

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Torben Laursen" wrote in message
...
Hi
I have this simple test function that I'm using in order to

learn how to use
Offset:
Code:
Option Explicit
Option Base 1
Public Function PT_Flash(P As Double, T As Double) As Double
Dim PT_Value As Double
ActiveCell.Offset(10, 10).Value = "test me"
'the line above gives a error.
PT_Value = P * T
PT_Flash = PT_Value
End Function

But no matter what I have tryed I cannot get the line with
"ActiveCell.Offset" to work, is allways give me error 2015
Any hint to as how to use ActiveCell.Offset?

Thanks Torben



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date:

27/01/2004






---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.572 / Virus Database: 362 - Release Date: 27/01/2004


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
why does excel 2007 subtract 2009 from 2015 = 1900? Penny32 Excel Worksheet Functions 7 May 11th 09 06:19 PM
If activecell.column = variable then activecell,offset (0,1) Battykoda via OfficeKB.com Excel Discussion (Misc queries) 1 October 2nd 07 08:05 PM
how to avoid zero error in log log plot rgandhi1 Charts and Charting in Excel 1 February 14th 07 09:07 PM
How to Subtract times on 24hour clock and avoid error message in . Clueless Excel Worksheet Functions 5 November 9th 06 05:48 PM
how can i avoid an error message while printing an excel sheet solidad Excel Discussion (Misc queries) 1 August 13th 06 01:00 PM


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