excel - Error message if no data entered in text box -


please suggest vb code, if text box left blank,and during tab/enter, error message box appears each text box.

private sub commandbutton1_click()    sheets("attendance").select    range("a1").select          if isempty(activecell) = false          activecell.offset(1, 0).select       end if    loop until isempty(activecell) = true     activecell.value = me.d.value    activecell.offset(0, 1).select    activecell.value = me.n.value    activecell.offset(0, 1).select    activecell.value = me.salary.value    activecell.offset(0, 1).select    activecell.value = me.remarks.value    activecell.offset(0, 1).select    activecell.value = me.it.value    activecell.offset(0, 1).select    activecell.value = me.outtime.value    activecell.offset(0, 1).select    activecell.value = me.lunch.value    activecell.offset(0, 3).select    activecell.value = me.advance.value    activecell.offset(0, 2).select    activecell.value = me.paid.value end sub 

please see below sub , try user form.

    private sub textbox1_exit(byval cancel msforms.returnboolean)         if me.textbox1 = ""             msgbox "you must enter value!"             cancel = true             me.textbox1.setfocus         end if     end sub 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -