ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA to check omissions and show/hide form (https://www.excelbanter.com/excel-programming/442678-vba-check-omissions-show-hide-form.html)

Valerie

VBA to check omissions and show/hide form
 
Hello, all.

I have a macro where I want it to check 5 columns on each line for errors
and if there are needed corrections then show the user form, if not, to
continue. I keep receiving an Object Error message at the "frm.Hide" line.

Range("A2").Select
TotalRowsToDo = ActiveCell.CurrentRegion.Rows.Count
Counter = 1

Do Until Counter = TotalRowsToDo

If Len(ActiveCell.Offset(0, 2).Value) < 4 Then frm.Show Else
If Len(ActiveCell.Offset(0, 3).Value) < 4 Then frm.Show Else
If Len(ActiveCell.Offset(0, 5).Value) < 8 Then frm.Show Else
If Len(ActiveCell.Offset(0, 4).Value) < 10 And
Len(ActiveCell.Offset(0, 6).Value) < 8 _
Or Len(ActiveCell.Offset(0, 6).Value) 9 Then frm.Show Else
If IsEmpty(ActiveCell.Offset(0, 4).Value) And _
IsEmpty(ActiveCell.Offset(0, 6).Value) Then frm.Show
frm.Hide
ActiveCell.Offset(1, 0).Select

Counter = Counter + 1
Loop

Thanks in advance for your help!
Valerie



All times are GMT +1. The time now is 07:35 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com