[VBA] Lan Cia's Question
每一次点击那四个buttton的时候,macro应该先设置 cell A100 的数值为:F24,F25,F26 或 F27
如此一来,当你点击Userform里 aceept buttton的时候,macro可以读取cell A100 的数值,再根据此数值来填充 cell F24,F25,F26 或 F27
Private Sub CommandButton1_Click()
Range("A100").Value = "F24"
TBS2005.Show
End Sub
Private Sub CommandButton2_Click()
Range("A100").Value = "F25"
TBS2005.Show
End Sub
Private Sub CommandButton3_Click()
Range("A100").Value = "F26"
TBS2005.Show
End Sub
Private Sub CommandButton4_Click()
Range("A100").Value = "F27"
TBS2005.Show
End Sub
Private Sub CommandButton1_Click()
Dim targetCell As Range
Set targetCell = Range(Range("A100").Value)
If OptionButton1.Value Then
targetCell.Value = OptionButton1.Caption
ElseIf OptionButton2.Value Then
targetCell.Value = OptionButton2.Caption
ElseIf OptionButton3.Value Then
targetCell.Value = OptionButton3.Caption
ElseIf OptionButton4.Value Then
targetCell.Value = OptionButton4.Caption
End If
Set targetCell = Nothing
Unload Me
End Sub
Source: ---
Disclaimer: The information in this webpage is shared by anonymous users from external online sources. We cannot guarantee its accuracy or truthfulness. Users should exercise caution and verify information independently.