View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
protonLeah
 
Posts: n/a
Default Message box before another macro


I have mod'ed your code as indicated (red). My small test worked:
_________________________________
Sub Look_Here1()
If Range("Q55") = True Then 'no quotes
MsgBox "Check Driver's License Expiration Date", 48,
"ExpiredDriver's License"
Else
Dim FoundCell As Variant
Dim teststr As String 'for testing only
Dim WhatFor As Variant
WhatFor = ActiveSheet.Cells(7, 2).Value

With Worksheets(1).Range("B8:B990")
Set FoundCell = .Find(WhatFor, LookIn:=xlValues,
MatchCase:=False)
End With

'note: with the word "testing" in B33, FoundCell held the value
"testing" after the find operation, and not the address itself.
teststr = FoundCell.Address 'used to test only (teststr = $B$33, now)
If FoundCell Is Nothing Then
Range("A7").Select
ActiveCell.FormulaR1C1 = "X"
Range("D7").Select
Else
FoundCell.Offset(0, -1).Select
ActiveCell.FormulaR1C1 = "X"
Selection.Offset(0, 4).Select
End If
End If
End Sub


--
protonLeah
------------------------------------------------------------------------
protonLeah's Profile: http://www.excelforum.com/member.php...o&userid=32097
View this thread: http://www.excelforum.com/showthread...hreadid=544103