View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default VBA Challenge - Flag Missing Info


This will work but you need to enhance if the form contains
Frames or Multipage controls.


dim itm as variant, bFlag as boolean
for each itm in array ("CheckBox1", "CheckBox3")
with me.controls(itm)
if .value=0 then
.backcolor=vbred
if not bflag then .setfocus
bFlag=true
else
.backcolor=vb3dface
endif
end with
next
if not bflag then
'can exit
end if


Instead of using the array as described above, you could
create 1 or more collections of controls in your forms initialize event.

OR put similar controls in a frame..
OR use the .TAG property to mark it as Critical.



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


V-Man wrote :

Hi all,

I have a userform with various fields. Some fields are essential for
a user to fill out. Before a user saves the form, I want to be able
to flag the critical fields (maybe change their color) that have not
been completed and generate a message which indicates the specific
fields that need information. This is similar to when you fill out an
application online and the missing info is highlighted before you can
continue.

I can give more details if you need!

Thanks,

V-Man