0
我正试图推出一份问卷调查问卷。用户可以回答单选按钮,从是,有的,可能和不可以。这份调查问卷包含在名为经理的工作表中。缩短我的代码
如果他们选择“是”或“否”,我想将问题复制到标有“是”和“否”的表格中的单独表格中,以选择“是”还是“否”。这张表被称为Follow Up。
我有200多个问题,所以你可以理解为什么我想缩短代码。
我的第二个问题是,如果他们将他们的想法从no改为yes,我想从no列中删除复制的问题。当他们改变主意时,问题就会被复制到两者中。
以下是我的代码已经有:
Private Sub OptionButton1_Click()
If OptionButton1.Value = True Then 'This is yes
Worksheets("Manager").Range("B3").Copy _ 'Within B3 is the person's name
Destination:=Worksheets("Follow Up").Range("B3") 'In this B3 I need the person's name
End If
If OptionButton1.Value = True Then
Worksheets("Manager").Range("B9").Copy _ 'B9 holds the question
Destination:=Worksheets("Follow Up").Range("B6") 'B6 is where I want it to go
End If
End Sub
Private Sub OptionButton4_Click()
If OptionButton4.Value = True Then 'This is for no
Worksheets("Manager").Range("B3").Copy _
Destination:=Worksheets("Follow Up").Range("B3")
End If
If OptionButton4.Value = True Then
Worksheets("Manager").Range("B9").Copy _
Destination:=Worksheets("Follow Up").Range("C6")
End If
End Sub
如果此代码适合您,但您想要改进它,那么此代码可能更适合于[代码审阅](http://codereview.stackexchange.com/)。 – skrrgwasme 2014-10-02 14:05:07
如果某人在某个问题上改变了主意,该怎么办?你的“否”程序需要撤销你的“是”,反之亦然。 – 2014-10-02 15:49:31
这就是我困在蒂姆身上的那一点 – Biffy261 2014-10-03 16:52:38