Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I need to add a message box to the front end of a search macro that
will trigger based on certain criteria and, in the absence of those criteria, allow the macro to proceed. Sounds like a simple "IF..Then..Else", but I cannot get the syntax to agree, even after pouring through this group and using previously suggested solutions. I need this: If Range("Q55") = "True" Then MsgBox"blah blah blah" Else RunMacro1 VB kicks back a "Type Mismatch" every time on the very first statement here. I have tried the True with and without quotes, same result. Entire code is below. Help is appreciated. Sub Look_Here1() If Range("Q55") = "true" Then MsgBox "Check Driver's License Expiration Date", 48, "Exprired Driver's License" Else Dim FoundCell As Range Dim WhatFor As Variant WhatFor = ActiveSheet.Cells(7, 2).Value Set FoundCell = Range("B8:B990").Find(What:=WhatFor, after:=ActiveCell, _ SearchDirection:=xlNext, searchorder:=xlByRows, _ MatchCase:=False) 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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Row Expansion | Excel Worksheet Functions | |||
Search, Copy, Paste Macro in Excel | Excel Worksheet Functions | |||
Closing File Error | Excel Discussion (Misc queries) | |||
Macro message box | Excel Discussion (Misc queries) | |||
Macro - message box if find nothing | Excel Discussion (Misc queries) |