|
>'=========================================================
>Sub test()
> Dim シート名 As Variant
> Dim rng As Range
> Dim g0 As Long
dim g1 as long '追加してください
> Dim orw As Long
> シート名 = Array("甲", "乙", "丙")
> With Worksheets("sheet1")
> Set rng = .Range("a2", .Cells(.Rows.Count, 1).End(xlUp))
> End With
> If rng.Row > 1 Then
> For g0 = 1 To rng.Count
> For g1 = LBound(シート名) To UBound(シート名)
> If InStr(rng(g0, 2), シート名(g1)) > 0 Then
> With Worksheets(シート名(g1))
> orw = .Cells(.Rows.Count, 1).End(xlUp).Row + 1
> .Range(.Cells(orw, 1), .Cells(orw, 2)).Value = rng(g0).Resize(, 2).Value
> End With
> End If
> Next
> Next
> End If
>End Sub
|
|