Private Sub CommandButton1_Click()
On Error Resume Next
If Len(ListBox3) > 0 Then ' 如果文字框有文字
Sheets("刨花板").Select
Sheets("刨花板").[h1] = ListBox3.Text
If WorksheetFunction.CountIf(Sheets("刨花板").Range("H:H"), [h1].Value) < 2 Then
Sheets("sheet1").Select
UserForm1.Show 0
UserForm1.ListBox3 = ""
Else
[h1].Select
Sheets("刨花板").Cells.Find(What:=[h1], After:=ActiveCell).Activate
ActiveCell.Offset(0, 1).Select
ActiveCell.EntireRow.Select
Selection.Copy
Sheets("Sheet1").Select
Selection.Insert Shift:=xlUp
Call CycleThrough
End If
End If
End Sub
以上代码在WPS内可以运行,但是在OFFICE2003内就复制不了数据,请各位帮忙修正一下
Private Sub CommandButton1_Click()
If Len(ListBox3) > 0 Then
With Sheets("刨花板")
If WorksheetFunction.CountIf(.[H:H], ListBox3) < 1 Then
ListBox3.Clear
Else
Set W = .[H:H].Find(ListBox3)
W.EntireRow.Copy
Rows(Selection.Row).Insert
Call CycleThrough
End If
End With
End If
End Sub
Private Sub CommandButton1_Click()
If Len(ListBox3) > 0 Then
With Sheets("刨花板")
If WorksheetFunction.CountIf(.[H:H], ListBox3) < 1 Then
ListBox3.Clear
Else
Set W = .[H:H].Find(ListBox3)
W.EntireRow.Copy
Rows(Selection.Row).Insert
Call CycleThrough
End If
End With
End If
End Sub