Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Function tests OK but doen't work when called

Hello,
I just managed making my first VBA function.
The function was tested in step-by-step mode and works OK
but when I call it from an actual spreadsheet is does
only part of the work.
The function does a lookup on another spreadsheet using
Vlookup, then returns the value of the row where the
match was found, copies the same row and should paste
this row on my active worksheet right from the active
cell. In step-by-step mode the function does everything
including the pasting part, but when I call the function
it will correctly return the value of the lookup row, but
will not do any pasting.
Any help is greatly appreciated.

Roel
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 340
Default Function tests OK but doen't work when called

Roel, functions can only modify the value in the cell containing them. They
can not modify other cells or parts of a workbook.

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"Roel" wrote in message
...
Hello,
I just managed making my first VBA function.
The function was tested in step-by-step mode and works OK
but when I call it from an actual spreadsheet is does
only part of the work.
The function does a lookup on another spreadsheet using
Vlookup, then returns the value of the row where the
match was found, copies the same row and should paste
this row on my active worksheet right from the active
cell. In step-by-step mode the function does everything
including the pasting part, but when I call the function
it will correctly return the value of the lookup row, but
will not do any pasting.
Any help is greatly appreciated.

Roel



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Function tests OK but doen't work when called

Thank you, Bob,
I actually used your add-ins for the Vlookup-part. Can my
function call a sub which will modify other parts of the
sheet (doesn't seem like that) or how do I do this
correctly? Still searching through your add-ins ...
(greatly appreciated!)

Roel van der Heide

-----Original Message-----
Roel, functions can only modify the value in the cell

containing them. They
can not modify other cells or parts of a workbook.

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros

for Excel

"Roel" wrote in

message
...
Hello,
I just managed making my first VBA function.
The function was tested in step-by-step mode and works

OK
but when I call it from an actual spreadsheet is does
only part of the work.
The function does a lookup on another spreadsheet using
Vlookup, then returns the value of the row where the
match was found, copies the same row and should paste
this row on my active worksheet right from the active
cell. In step-by-step mode the function does everything
including the pasting part, but when I call the

function
it will correctly return the value of the lookup row,

but
will not do any pasting.
Any help is greatly appreciated.

Roel



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Function tests OK but doen't work when called


There is no way to do this from a User Defined Function in a worksheet Cell.
You might be able to do this with the calculate event by checking the value
of the cell. However, if you are editing the value of some cell and want
the action to happen, you should probably use the Change Event.

More would need to be known about what triggers the action to give a good
recommendation.

--
Regards,
Tom Ogilvy

"Roel" wrote in message
...
Thank you, Bob,
I actually used your add-ins for the Vlookup-part. Can my
function call a sub which will modify other parts of the
sheet (doesn't seem like that) or how do I do this
correctly? Still searching through your add-ins ...
(greatly appreciated!)

Roel van der Heide

-----Original Message-----
Roel, functions can only modify the value in the cell

containing them. They
can not modify other cells or parts of a workbook.

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros

for Excel

"Roel" wrote in

message
...
Hello,
I just managed making my first VBA function.
The function was tested in step-by-step mode and works

OK
but when I call it from an actual spreadsheet is does
only part of the work.
The function does a lookup on another spreadsheet using
Vlookup, then returns the value of the row where the
match was found, copies the same row and should paste
this row on my active worksheet right from the active
cell. In step-by-step mode the function does everything
including the pasting part, but when I call the

function
it will correctly return the value of the lookup row,

but
will not do any pasting.
Any help is greatly appreciated.

Roel



.



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
What function tests for whole number (no decimals)? Andrew R Excel Worksheet Functions 1 January 25th 08 04:36 PM
How do I know which cell a function is called from? Murami Excel Worksheet Functions 3 November 24th 06 02:22 PM
What is this function called?? jPaulB Excel Discussion (Misc queries) 3 August 4th 06 08:33 PM
Average a group of tests for grade, some tests not taken by all. Scafidel Excel Discussion (Misc queries) 4 August 19th 05 03:50 AM
Possible to know who has called a function ? Isabelle Robin Excel Programming 3 March 5th 04 12:33 AM


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