|
Private Sub CommandButton1_Click()
Dim STR As String
STR = Application.GetOpenFilename("EXCEL文件(*.xls*), *.xls*")
If STR = "False" Then Exit Sub
Set wb = Workbooks.Open(STR)
Dim rr()
ReDim rr(1 To wb.Worksheets.Count, 1 To 1)
For Each SH In wb.Worksheets
n = n + 1
rr(n, 1) = SH.Name
Next SH
ListBox1.List = rr
ThisWorkbook.Activate
End Sub
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
For i = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(i) = True Then
xh = i
Exit For
End If
Next i
If xh <> "" Then
Set SH = ThisWorkbook.Worksheets("配方排序整理")
lastRow = SH.Cells(SH.Rows.Count, 2).End(xlUp).Row
If lastRow > 2 Then SH.Range("A3:H" & lastRow).EntireRow.Delete '删除所选区域所在的整行
mc = ListBox1.List(xh, 0)
Set SHt = wb.Worksheets(mc)
With SHt
lastRow = .Cells(.Rows.Count, 2).End(xlUp).Row
.Range("A3:G" & lastRow).EntireRow.Copy SH.Cells(3, "A")
End With
wb.Close False
End
End If
End Sub
|
评分
-
1
查看全部评分
-
|