Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need a VB msgbox based on last row of querytable object (text import)

Status
Not open for further replies.

tulipsfree

Technical User
Joined
Jul 27, 2003
Messages
7
Location
US

Need the msgbox to alert when the 'last non-blank' in a column is '1' (or 'true') -- immediately after (or as part of) a refresh event of a querytable object importing a .txt file.

This is some code I came up with off the top of my head that, so far, doesn't work:

Sub SignalAlert()
Dim j, k, n, o As Boolean
Set j = Range("J4").End(xlDown).Select
Set k = Range("K4").End(xlDown).Select
Set n = Range("N4").End(xlDown).Select
Set o = Range("O4").End(xlDown).Select
If j = 1 Then
Ans = MsgBox("text")
ElseIf k = 1 Then
Ans = MsgBox("text")
ElseIf n = 1 Then
Ans = MsgBox("text")
ElseIf o = 1 Then
Ans = MsgBox("text")
End If
End Sub


Thanks for your help,
Tulip
 
oops -- forgot to mention is is VB6 for Excel.

Any help at all is most appreciated...

Thanks again,
Tulip
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top