View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
patrick molloy patrick molloy is offline
external usenet poster
 
Posts: 391
Default Help with Selection Property

a slightly easier method...assumes the ActiveX combo...

Sub SetCombo()

With Worksheets("Sheet1")
.ComboBox15.ListFillRange = _
"E2:E" & .Range("E5000").End(xlUp).Row
End With

End Sub

This sets the combo to a table starting in row 2 with an
indeterminate number of rows

HTH
Patrick Molloy
Microsoft Excel MVP
-------------------
I Feel Great!

-----Original Message-----
Hi,
I have the following code
Dim count1 As Integer
Worksheets("ABC").Activate
ActiveSheet.Range("AR:AR").Select
count1 = Selection.Column.count
For i = 1 To count1
ComboBox15.AddItem CStr(Sheet1.Range("AR" + CStr

(i)).Value)
Next

I want to know the last row number in column AR that

contains the data (Column AR has blank cells too ) and
run the loop equal number of times.
But every time I run this code, it gives an error on

line "count1 = Selection.Column.count"
Plz help
Thnks
.