|
楼主 |
发表于 2011-3-29 15:01
|
显示全部楼层
以下是原代码:
Private Sub cmdSave_Click()
On Error Resume Next
Dim k As Byte
For k = 1 To 4
Set Control = Controls(Split("ComboBox1.Text,ComboBox1,ComboBox2,ComboBox3,ComboBox4,", ",")(k - 1))
If Control.Value = "" Then
MsgBox Split("单位,,单据号,结算方式", ",")(k - 1) & "为空,请重新输入!", 48, "提示"
Control.SetFocus
Exit Sub
End If
Next
Set rg = Worksheets("收支表").Range("C:C").Find(ComboBox2.Text)
If Not rg Is Nothing Then
MsgBox "这个单据号已经存在!"
Exit Sub
End If
Worksheets("收支表").Activate
Myr = [a65536].End(xlUp).Row
n = Myr + 1
Cells(n, 1).Value = ComboBox1.Text
Cells(n, 2).Value = ComboBox2.Text
Cells(n, 3).Value = ComboBox3.Text
Cells(n, 4).Value = ComboBox4.Text
n = n + 1
Call 清除控件
Application.ScreenUpdating = True
MsgBox "已录入!!", 64, "提示"
End Sub
我想询问的是 Myr = [a65536].End(xlUp).Row 这条代码,能限定为10-100行之间么?
代码怎么写呢。
因为是菜鸟,所以比较罗嗦,勤学好问,别介意啊
如果用4楼的代码,NEXT该放哪? |
|