View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default clear form combo boxes problem

Private Sub CommandButton1_Click()
dim cntrl as MSForms.Control
For Each cntrl in Userform2.Controls
if typeof cntrl is MSForms.Combobox then
cntrl.Listindex = -1
end if
Next

end sub

--
Regards,
Tom Ogilvy

"Profairy " wrote in message
...
Hi Tom,

Could you give me a quick example of how what to put in my new sub to
set all cbo boxes to -1

so far i've done

dim cbo as Combobox

For Each cbo in Userform2
if cbo.value = 0 then
cbo.value = -1
end if

Next

end sub

this doesn't work... i'm just guessing really as i'm still very new to
excel vba.

Thanks
helen x
;)


---
Message posted from http://www.ExcelForum.com/