作者:乔山办公网日期:
返回目录:excel表格制作
步骤如下:
1.A1中有如下字符串
2.Alt+F11,打开VBE,输入如下代码
3.字符串部分就留赋予变量s了
右击文本框,选“指定宏(N)...",新建一个过程,注意文本框的名字,代码如下:
本代码在Excel2010中测试成功
Sub 保存属道性()
Dim y As Object, j As Byte
For Each y In Worksheets("资料面").OLEObjects
If InStr(y.Name, "CommandButton") Then
j = Replace(y.Name, "CommandButton", "")
Worksheets("保存回答").Range("C" & (x - 1) * 20 + j - 1) = y.Enabled
End If
Next
End Sub
Sub 读取保存数据()
Dim y As Object, j As Byte
For Each y In Worksheets("资料面").OLEObjects
If InStr(y.Name, "CommandButton") Then
j = Replace(y.Name, "CommandButton", "")
y.Enabled = Worksheets("保存").Range("C" & (x - 1) * 20 + j - 1)
End If
Next
End Sub
str=textbox1.text