VBA to check omissions and show/hide form

V

Valerie

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top