Good Evening I am trying to call a code when a value appears in a column. I am trying the code below, but it works every time the value appears. I just want to call the code once if, say "4W" appears in the column. "4W" may appear multiple times in the column. Is there some way to return a True or False maybe to call the code? Thank you!
<style type="text/css"> p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000 ; background-color: #ffffff } p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; background-color: #ffffff ; min-height: 13.0px} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000 ; background-color: #ffffff ; min-height: 13.0px} p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #011993 ; background-color: #ffffff } span.s1 {color: #011993 } span.s2 {color: #000000 } </style>Sub Main()
Dim wb1 As Worksheet
Set wb1 = Sheets("Sheet1")
With wb1
For i = 2 To .Cells(Rows.Count, 2).End(xlUp).Row
If .Cells(i, 2).Value = "4W" Then
Call TimeStampWest
ElseIf .Cells(i, 2).Value = "4E" Then
Call TimeStampEast
ElseIf .Cells(i, 2).Value = "CCU" Then
Call TimeStampCCU
End If
Next
End With
End Sub
<style type="text/css"> p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000 ; background-color: #ffffff } p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; background-color: #ffffff ; min-height: 13.0px} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #000000 ; background-color: #ffffff ; min-height: 13.0px} p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #011993 ; background-color: #ffffff } span.s1 {color: #011993 } span.s2 {color: #000000 } </style>Sub Main()
Dim wb1 As Worksheet
Set wb1 = Sheets("Sheet1")
With wb1
For i = 2 To .Cells(Rows.Count, 2).End(xlUp).Row
If .Cells(i, 2).Value = "4W" Then
Call TimeStampWest
ElseIf .Cells(i, 2).Value = "4E" Then
Call TimeStampEast
ElseIf .Cells(i, 2).Value = "CCU" Then
Call TimeStampCCU
End If
Next
End With
End Sub