|
こんにちは
F列に「1」ですか?
前提のコードと一つずれてますね。
Dim a As String
Dim x As Long
Dim i As Long
a = Me.TextBox1.Text
With Worksheets("Sheet1")
x = .Range("E65536").End(xlUp).Row
For i = 4 To x
If InStr(1, .Cells(i, "E").Value, a) > 0 Then
.Cells(i, "F").Value = 1
Else
.Cells(i, "F").ClearContents
End If
Next
End With
とか
Dim a As String
Dim f As Range
Dim r As Range
Dim s As Range
a = Me.TextBox1.Text
With Worksheets("Sheet1")
Set r = Intersect(.Range("A3").CurrentRegion, .Range("A4:D65536"))
For Each s In r.Rows
Set f = s.Find(a, , xlValues, xlPart)
If f Is Nothing Then
.Cells(s.Row, "F").ClearContents
Else
.Cells(s.Row, "F").Value = 1
End If
Next
End With
|
|