将下现有代码复制到VBA编辑器中,加载在控件里运行就可以了
Sub localdata()
x = 2
Do While Sheet1.Cells(x, 1) <> ""
x = x + 1
Loop
n = 2
If ActiveSheet.Cells(n, 1) = "" Then
MsgBox "内容不完整,请确认!"
Exit Sub
End If
Do While n<= 3
On Error Resume Next
Sheet1.Cells(x, 1) = ActiveSheet.Cells(n,1)
Sheet1.Cells(x, 2 )= ActiveSheet.Cells(n,2)
Sheet1.Cells(x, 3) = ActiveSheet.Cells(n, 3)
Sheet1.Cells(x,4) = ActiveSheet.Cells(n, 4)
Sheet1.Cells(x, 5) = ActiveSheet.Cells(n, 5)
Sheet1.Cells(x, 6) = ActiveSheet.Cells(n, 6)
x = x + 1
n = n + 1
Loop
CommandButton1.TakeFocusOnClick = False
ActiveWorkbook.Save
End Sub
没看懂,到底要做什么呢?