Problem running code in proper order

P

Patrick C. Simonds

My problem is that the code:

Call FindLastNoXXX.FindLastNoXXX

does not seem to complete before the UserForm displays. The FindLastNoXXX
code needs to place a value in Cell AA5 prior to the UserForm opening. Any
ideas?

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

If rng(1, 2).Value = "" Then
Application.EnableEvents = False
GoTo Finished

End If

If Not Application.Intersect(Target, Range("C7:V700")) Is Nothing Then
'NoShowDataInput.Show

Call FindLastNoXXX.FindLastNoXXX

NoShowDataInput.Show

End If

Finished:

End Sub
 
D

Dave Peterson

It's a very bad idea to have modules and procedures share the same name.

I don't know if that's the cause of your problem, but I change the name of one
of those.
 
D

Dave Peterson

ps. Maybe the code in that FindLastNoXXX is not doing what you expect. You may
want to share that.
 
P

Patrick C. Simonds

Thank you for your time. I named the module the same just for the ability to
find what I am looking for more quickly, but as a buffer, I will take your
advice to heart. Just wondering what the danger of using the same name might
be.

As to my original problem. I have solved that one. Out of 50,172 characters
I missed typed 1 number. It took almost 5 hours to track that down.
 

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