ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Data Validation and List Length (https://www.excelbanter.com/excel-programming/314009-data-validation-list-length.html)

Tom Kolkmeier

Data Validation and List Length
 

I'm trying to make a combo box that allows me to display more than
rows of data in the drop down list. I copied/pasted macro from sampl
file listed at www.contextures.on.ca/excelfiles.html#DataVal, but
can't get combo box to "behave" properly in my spreadsheet. I name
the combo box "TempCombo" to match the macro name. When I double clic
on the cell containing my datavalidation list, the macro initiates th
combo box, but the box doesn't insert the "LinkedCell" an
"ListFillRange" like it's supposed to. Anyone try to use this before
Thanks

--
Tom Kolkmeie
-----------------------------------------------------------------------
Tom Kolkmeier's Profile: http://www.excelforum.com/member.php...fo&userid=1546
View this thread: http://www.excelforum.com/showthread.php?threadid=27050


Debra Dalgleish

Data Validation and List Length
 
The sample workbook uses a list on the same worksheet. If you're using a
named range on a different sheet, you could add a reference to that
sheet. For example:

'===========================
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Dim str As String
Dim cboTemp As OLEObject
Dim ws As Worksheet
Dim wsList As Worksheet
Set ws = ActiveSheet
Set wsList = Sheets("Sheet2")
Cancel = True
Set cboTemp = ws.OLEObjects("TempCombo")
On Error Resume Next
With cboTemp
.ListFillRange = ""
.LinkedCell = ""
.Visible = False
End With
On Error GoTo errHandler
If Target.Validation.Type = 3 Then
Application.EnableEvents = False
str = Target.Validation.Formula1
str = Right(str, Len(str) - 1)
With cboTemp
.Visible = True
.Left = Target.Left
.Top = Target.Top
.Width = Target.Width + 5
.Height = Target.Height + 5
.ListFillRange = wsList.Range(str).Name
.LinkedCell = Target.Address
End With
cboTemp.Activate
End If

errHandler:
Application.EnableEvents = True
Exit Sub

End Sub
'===========================

Tom Kolkmeier wrote:
I'm trying to make a combo box that allows me to display more than 8
rows of data in the drop down list. I copied/pasted macro from sample
file listed at www.contextures.on.ca/excelfiles.html#DataVal, but I
can't get combo box to "behave" properly in my spreadsheet. I named
the combo box "TempCombo" to match the macro name. When I double click
on the cell containing my datavalidation list, the macro initiates the
combo box, but the box doesn't insert the "LinkedCell" and
"ListFillRange" like it's supposed to. Anyone try to use this before?
Thanks!




--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com