|
- Private Sub CommandButton1_Click()
- Dim arr
- Dim lLastRow As Long
- With Me.列表框
- If .ListCount > 0 Then
- Application.ScreenUpdating = False
- Application.DisplayAlerts = False
- Application.EnableEvents = False
- arr = Me.列表框.List
- lLastRow = Cells(Rows.Count, 2).End(xlUp).Row + 1
- Cells(lLastRow, 2).Resize(.ListCount, UBound(arr, 2) + 1).Value = arr
- Cells(lLastRow, 1).Value = Format(Date, "yyyy/m/d")
- If .ListCount > 1 Then
- Cells(lLastRow, 1).AutoFill Cells(lLastRow, 1).Resize(.ListCount)
- End If
- Else
- MsgBox "列表框中无数据"
- Exit Sub
- End If
- End With
- Application.ScreenUpdating = True
- Application.DisplayAlerts = True
- Application.EnableEvents = True
- MsgBox "保存成功"
- End Sub
复制代码 |
|