|
いつものように作業列(IV列)に数式を埋めて判定し、処理するコードです。
Sub Set_MyAddress()
Dim MyR As Range
Application.ScreenUpdating = False
With Range("C1", Range("C65536").End(xlUp))
With .Offset(, 253)
.Formula = "=IF(OR(ISERR(FIND(""東京"",$C1))," & _
"ISERR(FIND(""様方"",$C1))),1," & _
"MID($C1,FIND(""東京"",$C1)," & _
"FIND(""様方"",$C1)+2-FIND(""東京"",$C1)))"
.Copy
.PasteSpecial xlPasteValues
Set MyR = .SpecialCells(2, 2)
End With
.ClearContents
MyR.Copy .Cells(1)
End With
Columns("$C:$C").AutoFit
Range("$IV:$IV").ClearContents: Set MyR = Nothing
With Application
.CutCopyMode = False
.ScreenUpdating = True
End With
End Sub
|
|