I have a list of information in column A of a worksheet. I want to check each cell, to see if it is contained within a string, and if so display a msg box"found"
I have a list of information in column A of a worksheet. I want to check each cell, to see if it is contained within a string, and if so display a msg box"found"
without seeing what you are working with...try =if(isnumber(search()),"Found",""), copied down
1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
2. If your question is resolved, mark it SOLVED using the thread tools
3. Click on the star if you think someone helped you
Regards
Ford
what/where is your prefered string?
ConnectorNum is a string that I am searching in. It is defined earlier. This above code doesn't work however, I get type mismatch on the testvalue line..![]()
Sorry, its in VBA so here is what I've come up with: Set CBws = Worksheets("Sheet1") Dim testvalue As String For i = 3 To 143 testvalue = Worksheets("Sheet1").Range("A" + i).Value If InStr(1, testvalue, ConnectorNum, vbTextCompare) = True Then MsgBox "Insert Found" Else MsgBox "Insert not found" End If Next i
Any ideas?
Few errors
![]()
Sub test() Set CBws = Worksheets("Sheet1") Dim testvalue As String For i = 3 To 143 testvalue = Worksheets("Sheet1").Range("A" & i).Value If InStr(1, testvalue, "ConnectorNum", vbTextCompare) > 0 Then MsgBox "Insert Found" Else MsgBox "Insert not found" End If Next i End Sub
![]()
Sub M_snb() sn=Worksheets("Sheet1").Range("A3:A143") For j=1 to ubound(sn) msgbox iif(InStr(ConnectorNum,sn(j,1)),"","not ") & "found") Next End Sub
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks