Code assist: Show UserForm when some iRow cells are empty

Big Lar

Well-known Member
Joined
May 19, 2002
Messages
557
I use this code to find existing Names in my data worksheet.

Code:
Private Sub ComboBox1_AfterUpdate()
Dim iRow As Long
    Dim ws As Worksheet
    Dim Name As String
    Dim CLoc As Range
    Set ws = Worksheets("Members")
   
    Name = Me.ComboBox1.Value
    Set CLoc = ws.Columns("C:C").Find(What:=Name, after:=ws.Cells(1, 3), LookIn:= _
                            xlFormulas, LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:= _
                            xlNext, MatchCase:=False, SearchFormat:=False)
 
    If CLoc Is Nothing Then
        iRow = ws.Cells(Rows.Count, 1) _
             .End(xlUp).Offset(1, 0).Row
    Else
       
        iRow = CLoc.Row
    End If
 
Do stuff…

Many cells in the data ws are incomplete.
I could use some help with writing this additional code so if/when the Name is selected, I can update the data with another UserForm.
As always, I’m open to suggestions on how to do this better/smarter/faster.

If
ws.Cells(iRow, 4),
ws.Cells(iRow, 5),
ws.Cells(iRow, 7),
ws.Cells(iRow, 8),
ws.Cells(iRow, 9),
ws.Cells(iRow, 10),
ws.Cells(iRow, 12),
are empty…Then,
UserFormUpdate.Show
Else
End If
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Hi,
maybe

Code:
    Dim rng As Range

    Set rng = Union(ws.Cells(iRow, 4), ws.Cells(iRow, 5), ws.Cells(iRow, 7), _
                ws.Cells(iRow, 8), ws.Cells(iRow, 9), ws.Cells(iRow, 10), ws.Cells(iRow, 12))
                
    If Application.CountA(rng) <> rng.Cells.Count Then UserFormUpdate.Show


Dave
 
Last edited:
Upvote 0
Hey, dmt32.
Not "maybe"...
It works perfectly!
Thanks for the assistance.

Now, If I can get it to SetFocus on the first blank Textbox in UserFormUpdate, I'd be "Golden"!

Happy coding!
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top