|
こんにちは
データシート=Sheet1としSheet2を作業用に使います
ではお試しを
Sub Test()
Dim Ms As String, i As Long, R As Range, Co As Long
With Worksheets("Sheet1")
.Range("A1").CurrentRegion.Copy
Worksheets("Sheet2").Range("A1").PasteSpecial xlPasteAll, , , True
Application.CutCopyMode = False
End With
With Worksheets("Sheet2")
For i = 2 To .Range("A1").End(xlToRight).Column
.Columns(i).AdvancedFilter xlFilterInPlace, , , True
Set R = .Range(.Cells(2, i), .Cells(65536, i).End(xlUp)) _
.SpecialCells(xlCellTypeVisible)
Co = R.SpecialCells(xlCellTypeConstants).Cells.Count
Set R = Nothing
.ShowAllData
Ms = Ms & .Cells(1, i).Value & "君は" & Co & "日間登校します" & Chr(10)
Co = 0
Next i
.Cells.Clear
End With
MsgBox Ms
End Sub
|
|