|
Sub add()
Dim i, j, h As Integer
j = Sheets("外在本就读花名册").[A65536].End(xlUp).Row
For i = 3 To j Step 1
Select Case Cells(i, 9).Value
Case "卫城"
h = Sheets("卫城").[A65536].End(xlUp).Row
Sheets("外在本就读花名册").Cells(i, 1).Resize(1, 12).Copy _
Sheets("卫城").Cells(h + 1, 1)
Case "站街"
h = Sheets("站街").[A65536].End(xlUp).Row
Sheets("外在本就读花名册").Cells(i, 1).Resize(1, 12).Copy _
Sheets("站街").Cells(h + 1, 1)
Case "流长"
h = Sheets("流长").[A65536].End(xlUp).Row
Sheets("外在本就读花名册").Cells(i, 1).Resize(1, 12).Copy _
Sheets("流长").Cells(h + 1, 1)
Case "王庄"
h = Sheets("王庄").[A65536].End(xlUp).Row
Sheets("外在本就读花名册").Cells(i, 1).Resize(1, 12).Copy _
Sheets("王庄").Cells(h + 1, 1)
Case "青龙"
h = Sheets("青龙").[A65536].End(xlUp).Row
Sheets("外在本就读花名册").Cells(i, 1).Resize(1, 12).Copy _
Sheets("青龙").Cells(h + 1, 1)
Case "红枫"
h = Sheets("红枫").[A65536].End(xlUp).Row
Sheets("外在本就读花名册").Cells(i, 1).Resize(1, 12).Copy _
Sheets("红枫").Cells(h + 1, 1)
Case Else
h = Sheets("清镇市外").[A65536].End(xlUp).Row
Sheets("外在本就读花名册").Cells(i, 1).Resize(1, 12).Copy _
Sheets("清镇市外").Cells(h + 1, 1)
End Select
Next
End Sub
这样改下就可以了 |
|