Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Eliminating bland from Data Validation list?

Hi,

I looked around other postings but could not find the answer -- what I'm
having a problem with is thta in my data validation list, I have a range set
(which refers to column H) -- the number within the range can change, and I
sort it every time it does change so that there are no spaces between values.


The problem is that there are numerous blanks in the list at bottom, after
the last actual value in the range. Is there any way to get rid of those
blanks? I tried deleting (delete shift up) all blank cells after the last
value and through the last cell (H65536), but this doesn't help. Below is my
code. Thanks!


With .Range("B2").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=dvrange"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Please select value"
.InputMessage = ""
.ErrorMessage = "Please select a value from the drop down menu."
.ShowInput = True
.ShowError = True
End With

--
Robert
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 144
Default Eliminating bland from Data Validation list?

I figured out a solution - don't know if it's the best solution, but it is
working. If there is a better solution you know of, I'd be interested to see
what it is.

What I did was definied a range within the workbook (by highighting the
initial range of cells I want to use in the validation list and then naming
the range "dvrange" by typing this into the upper right corner, just to the
left of the formula bar) and then added the code below to redefine the range
when needed:

With Sheets("Invoices not tied")
ActiveWorkbook.Names.Add Name:="dvrange", RefersToR1C1:=.Range("H1",
..Range("H65536").End(xlUp))
End With

--
Robert


"robs3131" wrote:

Hi,

I looked around other postings but could not find the answer -- what I'm
having a problem with is thta in my data validation list, I have a range set
(which refers to column H) -- the number within the range can change, and I
sort it every time it does change so that there are no spaces between values.


The problem is that there are numerous blanks in the list at bottom, after
the last actual value in the range. Is there any way to get rid of those
blanks? I tried deleting (delete shift up) all blank cells after the last
value and through the last cell (H65536), but this doesn't help. Below is my
code. Thanks!


With .Range("B2").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _
xlBetween, Formula1:="=dvrange"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Please select value"
.InputMessage = ""
.ErrorMessage = "Please select a value from the drop down menu."
.ShowInput = True
.ShowError = True
End With

--
Robert

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Eliminating bland from Data Validation list?

Hi Robert,

If you mean exclude blanks from the bottom of the list, and there are no
other blanks within the list, perhaps a dynamic range.

=OFFSET(dvrange,0,0,COUNTA(dvrange))

Maintain 'dvrange' at least as tall as your potential list.

Regards,
Peter T

"robs3131" wrote in message
...
I figured out a solution - don't know if it's the best solution, but it is
working. If there is a better solution you know of, I'd be interested to

see
what it is.

What I did was definied a range within the workbook (by highighting the
initial range of cells I want to use in the validation list and then

naming
the range "dvrange" by typing this into the upper right corner, just to

the
left of the formula bar) and then added the code below to redefine the

range
when needed:

With Sheets("Invoices not tied")
ActiveWorkbook.Names.Add Name:="dvrange", RefersToR1C1:=.Range("H1",
.Range("H65536").End(xlUp))
End With

--
Robert


"robs3131" wrote:

Hi,

I looked around other postings but could not find the answer -- what I'm
having a problem with is thta in my data validation list, I have a range

set
(which refers to column H) -- the number within the range can change,

and I
sort it every time it does change so that there are no spaces between

values.


The problem is that there are numerous blanks in the list at bottom,

after
the last actual value in the range. Is there any way to get rid of

those
blanks? I tried deleting (delete shift up) all blank cells after the

last
value and through the last cell (H65536), but this doesn't help. Below

is my
code. Thanks!


With .Range("B2").Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop,

Operator:= _
xlBetween, Formula1:="=dvrange"
.IgnoreBlank = True
.InCellDropdown = True
.InputTitle = ""
.ErrorTitle = "Please select value"
.InputMessage = ""
.ErrorMessage = "Please select a value from the drop down menu."
.ShowInput = True
.ShowError = True
End With

--
Robert



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
Crazy Data Validation ... List Validation Not Working TW Bake Excel Programming 1 March 29th 07 02:41 AM
data validation invalid in dynamic validation list ilia Excel Discussion (Misc queries) 0 November 7th 06 12:54 PM
data validation invalid in dynamic validation list ilia Excel Worksheet Functions 0 November 7th 06 12:54 PM
data validation invalid in dynamic validation list ilia Excel Programming 0 November 7th 06 12:54 PM
Eliminating choices on data validation Tim K[_3_] Excel Programming 1 October 2nd 06 10:35 PM


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