Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Immediate window gives different results to a UDF

Hello all,

Ok, now ive pulled all my hair out and called Microsoft every name
under the sun, i thought it about time I consulted some pros.

This works perfectly well in the immediate window (with debug.print),
however when used as an excel sheet function I just get the #VALUE!
error.

debug.print Sheets("MVP DB
Model").Range("A:A").SpecialCells(xlCellTypeVisibl e).Areas(2).Cells(1).Row

Private Function firstrow() As Variant
firstrow = Sheets("MVP DB
Model").Range("A:A").SpecialCells(xlCellTypeVisibl e).Areas(2).Cells(1).Row
End Function

Please help me by tell me it is something rediculasly simple that am
overlooking or is it a daft excel quirk?

Ive a similer problem with returning the address for the auto filter
range.
With the immediate window this gives me a text string that would be
able to split() however used in a function it gives me 1 range value.

Sheets("MVP DB Model").AutoFilter.Range.Offset(1,
0).SpecialCells(xlCellTypeVisible).Address


Any help or pointers are most graciously appreciated.

Regards,

David

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Immediate window gives different results to a UDF

On 1 Mar, 15:03, "Dave Mac" wrote:
Hello all,

Ok, now ive pulled all my hair out and called Microsoft every name
under the sun, i thought it about time I consulted some pros.

This works perfectly well in the immediate window (with debug.print),
however when used as an excel sheet function I just get the #VALUE!
error.

debug.print Sheets("MVP DB
Model").Range("A:A").SpecialCells(xlCellTypeVisibl e).Areas(2).Cells(1).Row

Private Function firstrow() As Variant
firstrow = Sheets("MVP DB
Model").Range("A:A").SpecialCells(xlCellTypeVisibl e).Areas(2).Cells(1).Row
End Function

Please help me by tell me it is something rediculasly simple that am
overlooking or is it a daft excel quirk?

Ive a similer problem with returning the address for the auto filter
range.
With the immediate window this gives me a text string that would be
able to split() however used in a function it gives me 1 range value.

Sheets("MVP DB Model").AutoFilter.Range.Offset(1,
0).SpecialCells(xlCellTypeVisible).Address

Any help or pointers are most graciously appreciated.

Regards,

David



*bounce*

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Immediate window gives different results to a UDF

..specialcells won't work within a UDF when called from a cell on a worksheet.

Dave Mac wrote:

Hello all,

Ok, now ive pulled all my hair out and called Microsoft every name
under the sun, i thought it about time I consulted some pros.

This works perfectly well in the immediate window (with debug.print),
however when used as an excel sheet function I just get the #VALUE!
error.

debug.print Sheets("MVP DB
Model").Range("A:A").SpecialCells(xlCellTypeVisibl e).Areas(2).Cells(1).Row

Private Function firstrow() As Variant
firstrow = Sheets("MVP DB
Model").Range("A:A").SpecialCells(xlCellTypeVisibl e).Areas(2).Cells(1).Row
End Function

Please help me by tell me it is something rediculasly simple that am
overlooking or is it a daft excel quirk?

Ive a similer problem with returning the address for the auto filter
range.
With the immediate window this gives me a text string that would be
able to split() however used in a function it gives me 1 range value.

Sheets("MVP DB Model").AutoFilter.Range.Offset(1,
0).SpecialCells(xlCellTypeVisible).Address

Any help or pointers are most graciously appreciated.

Regards,

David


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Immediate window gives different results to a UDF

On 1 Mar, 22:35, Dave Peterson wrote:
.specialcells won't work within a UDF when called from a cell on a worksheet.



Dave Mac wrote:

Hello all,


Ok, now ive pulled all my hair out and called Microsoft every name
under the sun, i thought it about time I consulted some pros.


This works perfectly well in the immediate window (with debug.print),
however when used as an excel sheet function I just get the #VALUE!
error.


debug.print Sheets("MVP DB
Model").Range("A:A").SpecialCells(xlCellTypeVisibl e).Areas(2).Cells(1).Row


Private Function firstrow() As Variant
firstrow = Sheets("MVP DB
Model").Range("A:A").SpecialCells(xlCellTypeVisibl e).Areas(2).Cells(1).Row
End Function


Please help me by tell me it is something rediculasly simple that am
overlooking or is it a daft excel quirk?


Ive a similer problem with returning the address for the auto filter
range.
With the immediate window this gives me a text string that would be
able to split() however used in a function it gives me 1 range value.


Sheets("MVP DB Model").AutoFilter.Range.Offset(1,
0).SpecialCells(xlCellTypeVisible).Address


Any help or pointers are most graciously appreciated.


Regards,


David


--

Dave Peterson


Thanks Dave. I'll try a different approach.

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
how to save a desired window size but hv window comeup fullsz by d smjm1982 Excel Discussion (Misc queries) 1 February 15th 08 11:10 AM
Missing Help Search Results Window Jim H. Excel Discussion (Misc queries) 2 October 18th 07 08:36 AM
Docking Project Explorer, Properties window and Code window in VBE jayray Setting up and Configuration of Excel 2 March 27th 07 04:42 PM
The window opens in a smaller window not full sized window. Rachael Excel Discussion (Misc queries) 0 November 7th 06 09:04 PM
Resizing search results window Judy F New Users to Excel 0 February 2nd 06 12:52 AM


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