Excel与vba和工作按钮共享工作表

时间:2013-06-28 14:13:59

标签: excel vba button locking

我正在尝试与一个打开一个新窗口(用vb制作)的按钮共享一个工作表但是当我分享它时,指向另一个窗口锁的简单按钮不起作用(是的,我取消选中锁定),theres我需要做些什么来分享那个按钮和另一个窗口?

这个窗口的工作是编辑单元格。

这是窗口的代码,有:

private Sub CommandButton1_Click()
Dim i, a, b, c, d
Dim prio As String
i = CInt(Sheets("Sheet1").Cells(6, 17))
a = CInt(Sheets("Sheet1").Cells(7, 17))


Sheets("Sheet1").Cells(i, 1) = a
Sheets("Sheet1").Cells(i, 2) = Peca.Text
Sheets("Sheet1").Cells(i, 3) = Qt.Text
Sheets("Sheet1").Cells(i, 4) = ComboBox1.Value
Sheets("Sheet1").Cells(i, 5) = Responsavel.Text
Sheets("Sheet1").Cells(i, 6) = Cliente.Text
Sheets("Sheet1").Cells(i, 7) = Maquina.Text
Sheets("Sheet1").Cells(i, 8) = NumSerie.Text
Sheets("Sheet1").Cells(i, 9) = Modelo.Text
Sheets("Sheet1").Cells(i, 10) = Obser.Text



Sheets("Sheet1").Cells(6, 17) = CInt(Sheets("Sheet1").Cells(6, 17)) + 1
Sheets("Sheet1").Cells(7, 17) = CInt(Sheets("Sheet1").Cells(7, 17)) + 1
Peca.Text = ""
Qt.Text = ""
ComboBox1.Value = ""
Responsavel.Text = ""
Cliente.Text = ""
Maquina.Text = ""
NumSerie.Text = ""
Modelo.Text = ""
Obser.Text = ""
End Sub

Private Sub CommandButton2_Click()
Sheets("Sheet1").Cells(12, 15) = Cliente.Text
End Sub

Private Sub CommandButton3_Click()
Sheets("Sheet1").Cells(12, 15) = Maquina.Text
Sheets("Sheet1").Cells(13, 15) = NumSerie.Text
Sheets("Sheet1").Cells(14, 15) = Modelo.Text
End Sub

Private Sub CommandButton4_Click()
Cliente.Text = Sheets("Sheet1").Cells(12, 15)
End Sub

Private Sub CommandButton5_Click()
Maquina.Text = Sheets("Sheet1").Cells(12, 15)
NumSerie.Text = Sheets("Sheet1").Cells(13, 15)
Modelo.Text = Sheets("Sheet1").Cells(14, 15)
End Sub

0 个答案:

没有答案