본문 바로가기

엑셀로 풀어가는 세상

엑셀 VBA #20 / Like 연산자_예제2 [VBA]

엑셀 VBA #20 / Like 연산자_예제2 [VBA]

 

Like함수 구조 :
If 문자셀 Like 패턴 Then.......

Sub Like연산자_예제2()

Dim i As Long, j As Long
Dim cn As Long

cn = Range("a1").CurrentRegion.Rows.Count
 For i = 2 To cn
      For j = 1 To Len(Cells(i, "a"))
            If Mid(Cells(i, "a"), j, 5) Like "D####" Then
                  Cells(i, "b") = Mid(Cells(i, "a"), j, 5)
            End If
      Next
Next

End Sub

 

vba#20.xlsm
0.02MB



https://www.youtube.com/watch?v=OG7qR-9IsNA&list=PLfxvqpVCYZ8e0qlyc_FU46neoWjO7yTWj&index=20

반응형