I am attempting to make a simple macro for an excel spreadsheet. For starters, my background is in C/C++ with some java, and vb experience peppered in.
Basically, the simple problem I am having is:
How do I test values in a particular cell to see if it contains certain text?
Here's what I have so far...
Private Sub CommandButton1_Click()
Dim MyCell As Range
Dim NumRows As Integer
Dim CellValue As Variant
Set MyCell = Worksheets(1).[a1]
NumRows = Application.CountA(ActiveSheet.Range("A:A"))
For Q = 2 To LastRow
CellValue = MyCell(Q, 3).Value
If CellValue.Text.Contains("ABC") Then
MsgBox "Found one"
Basically, I get errors as soon as it enters the loop. I'm sure this is a simple thing to do, but I'm just not used to the VBA language and I'm having a hard time finding examples. Thanks in advance.