vba - Userform disable all fields -


i have userform can filled in if previous userform filled in there calculations in userform based on previous input , if empty, calculations crash.

now did write few if statements check these empty values , had brain flash.. how if 1 of fields missing, userform disabled. thought, done , works :)

if dp1 = "" reportback.enable = false else end if 

that form , shows beautifully , nothing can changed, ohhh.. can´t close form, nothing works .. lol.

so question. there way disable fields input still have cancel button active ?

private sub cancel_click() unload reportback end sub 

use below code disable controls on form avoid issue. userform1 refers name of userform kindly replace accordingly.

dim ctrl control  each ctrl in userform1.controls     ctrl.enabled = false next  set ctrl = nothing 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -