I have a column that contains a text string (ex: NOTE 5). I want to search this column to see if there is a string other than "NOTE 5" (ex: NOTE 6). If there is I print notes 1-6, if not I print notes 1-5. IF "NOTE 6" is in column o (o7:o100) THAN print notes 1-6 ELSE print notes 1-5.
Find a text string in a column and perform action if true
-
-
-
Re: Find a text string in a column and perform action if true
Code
Display MoreOption Compare Text Sub PrintNote() For Each Note In ActiveSheet.Range("A1:A100").Cells If Note.Value = "" Then GoTo NC Select Case Note.Value Case Is <> "Note 5" 'Print Code Here MsgBox "Printing Notes 1-6" End Select NC: Next Note For Each Note2 In ActiveSheet.Range("O2:O100").Cells If Note2.Value = "" Then GoTo NC2 Select Case Note2.Value Case Is = "Note 6" 'Print Code Here MsgBox "Printing Notes 1-6" Case Else 'Print Code Here MsgBox "Printing Notes 1-5" End Select NC2: Next Note2 End Sub
-
Re: Find a text string in a column and perform action if true
To be honest, my VB isn't very good. This looks great but how do I put this in as Excel file?
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!