Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default SpecialCells and Names

I have created the following Function and tested it with some code

Public Function MyCells(ByVal MyRange As Range, MyOffset As Integer)

Set MyCells = MyRange.SpecialCells(xlCellTypeConstants, xlLogical).Offset(0,
MyOffset)

End Function

TEST CODE

Sub test()

MsgBox MyCells(ActiveSheet.Range("I1:I1000"), -2).Address

End Sub

The msgbox displays - $G$6,$G$9,$G$13:$G$88 which is the desired result.

However, when I create a name which refers to this function (using the same
inputs) and then use that name in validation, I get all entries from G1 to
G88 in the dropdown box.

Can anyone help with this??
--
Cheers!

Richard Reye

"Never argue with an idiot. They'll bring you down to their level then beat
you with experience" - someone
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default SpecialCells and Names

Drop down box can't use a dicontiguous range. You would have to either fill
it with additem or use formulas/code to build your range in another area and
refer to that.

--
Regards,
Tom Ogilvy


"Richard Reye" wrote in message
...
I have created the following Function and tested it with some code

Public Function MyCells(ByVal MyRange As Range, MyOffset As Integer)

Set MyCells = MyRange.SpecialCells(xlCellTypeConstants,

xlLogical).Offset(0,
MyOffset)

End Function

TEST CODE

Sub test()

MsgBox MyCells(ActiveSheet.Range("I1:I1000"), -2).Address

End Sub

The msgbox displays - $G$6,$G$9,$G$13:$G$88 which is the desired result.

However, when I create a name which refers to this function (using the

same
inputs) and then use that name in validation, I get all entries from G1 to
G88 in the dropdown box.

Can anyone help with this??
--
Cheers!

Richard Reye

"Never argue with an idiot. They'll bring you down to their level then

beat
you with experience" - someone



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
Specialcells Bruno Uato Charts and Charting in Excel 0 October 7th 05 07:42 PM
SpecialCells(xlCellTypeLastCell) Tom Ogilvy Excel Programming 0 July 21st 04 03:37 PM
SpecialCells(xlCellTypeFormulas) Kevin Gabbert Excel Programming 1 January 28th 04 05:06 PM
AutoFilter /specialcells Ron de Bruin Excel Programming 8 January 13th 04 03:45 PM
specialcells(xlcelltypeblanks) Neil[_11_] Excel Programming 5 October 9th 03 10:11 AM


All times are GMT +1. The time now is 05:16 PM.

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"