View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Carlee Carlee is offline
external usenet poster
 
Posts: 155
Default Some fields required question

Hello All,

I use the following code which loops through all fields on my user form,
searching for any text box that does not contain data.

Question: How can i modify this code such that only some of the fields are
searched for missing data, rather than all. Reason: on my user form, 40 of
the 60 text boxes are required entry, and i want to make sure those fields
contain data.

Dim ctrl as Object
for each ctrl in Userform1.Controls
if typeof ctrl is msforms.combobox then
if ctrl.Value = "" then
msgbox "Missing Data in " & ctrl.Name
exit sub
end if
end if
Next

--
Carlee