View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Shilps Shilps is offline
external usenet poster
 
Posts: 36
Default Help with Selection Property

Hi Bob

As U said that I am trying to count the rows, I chaged the code to following
Dim c As Intege
Worksheets("ABC").Activat
ActiveSheet.Range("AR:AR").Selec
c1 = Selection.Rows.Coun
For c = 2 To c
ComboBox15.AddItem CStr(Sheet1.Range("AR" + CStr(c)).Value
Next

But now it is giving error on lin
For c = 2 To c

But it is not giving error when I change the code t

Dim c As Intege
Worksheets("ABC").Activat
ActiveSheet.Range("AR:AR").Selec
c1 = MsgBox(Selection.Rows.Count, , no
For c = 2 To c
ComboBox15.AddItem CStr(Sheet1.Range("AR" + CStr(c)).Value
Next

How does adding a msgbox statement change it
Also if I change the code to, it gives error on "ComboBox15.AddItem CStr(Sheet1.Range("AR" + CStr(c)).Value)

Dim c As Lon
Worksheets("ABC").Activat
ActiveSheet.Range("AR:AR").Selec
c1 = Selection.Rows.Coun
For c = 2 To c
ComboBox15.AddItem CStr(Sheet1.Range("AR" + CStr(c)).Value
Next

TI
Shilps