我想根据Excel中第一列的选定下拉选项自动填充下一列。根据所选菜单使用vba自动填充excel上的特定列
下面,我认为最初的代码样本,但似乎我的做法是不正确。
Private Sub WorksheetStore_Change(ByVal Target As Range)
Dim i As Integer
Dim intCol As Integer
intCol = shtStoreGroup.Range("A")
If Not IsEmpty(Target.value) And intCol > 1 And Target.Columns.Count = 1 And Target.Column = intCol And Target.Row > Start_Row Then
For i = Target.Row To Target.Row + Target.Rows.Count - 1
If shtStoreGroup.Columns(intCol).Rows(i).value = "Create" Then
shtStoreGroup.Columns(intCol + 2).Rows(i).value = "N/A"
shtStoreGroup.Columns(intCol + 3).Rows(i).value = "Test"
Next i
End If
End Sub
我想“WorksheetStore”是您的工作表的名称。但是当你的组合框值发生变化时,你应该做些事情。例如:'Private Sub comboBoxName_Change()... End Sub' – tretom
或者当它失去焦点时:'Private Sub comboBoxName_LostFocus()... End Sub' – tretom
您可能想要添加更多关于涉及多少张表的细节,名称,应该开始发生什么,应该在哪里触发,... – user3598756