|
A列無しなら
Dim a As String
Dim x As Long
Dim i As Long
a = Me.TextBox1.Text
With Worksheets("Sheet1")
x = .Range("F65536").End(xlUp).Row
For i = 4 To x
If InStr(1, .Cells(i, "F").Value, a) > 0 Then
.Cells(i, "G").Value = 1
Else
.Cells(i, "G").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("B3").CurrentRegion, .Range("B4:E65536"))
For Each s In r.Rows
Set f = s.Find(a, , xlValues, xlPart)
If f Is Nothing Then
.Cells(s.Row, "G").ClearContents
Else
.Cells(s.Row, "G").Value = 1
End If
Next
End With
下のコードはF列の連結用の式は不要です。
|
|