Excel用户表单combobox一旦提交输出到excel

我是相对较新的整个VBA,所以任何帮助将不胜感激…我有我的combobox(一旦你点击提交button)input信息到我的Excel电子表格中的特定列的问题每次input新logging时,都会向下移动。

请参阅下面的代码,如果您需要任何进一步的信息请离开:)很多在此先感谢宝拉

Option Explicit Private Sub cmdAdd_Click() Dim irow As Long Dim EorP As String Dim ComboStaus As ComboBox Dim ws As Worksheet Set ws = Worksheets("BS Personal Data") 'find first empty row in spreadsheet irow = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _ SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1 EorP = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _ SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1 Combo = ws.Cells.Find(What:="*", SearchOrder:=xlRows, _ SearchDirection:=xlPrevious, LookIn:=xlValues).Row + 1 'copy the data to the spreadsheet With ws .Cells(irow, 1).Value = Me.txtmanager.Value .Cells(irow, 2).Value = Me.txtdivision.Value .Cells(irow, 3).Value = Me.txtlocation.Value .Cells(irow, 4).Value = Me.txtsystemname.Value .Cells(irow, 9).Value = Me.Txtpurpose.Value .Cells(irow, 10).Value = Me.txtaccess.Value .Cells(irow, 11).Value = Me.txtdatecompleted.Value End With 'clear the data Me.txtmanager.Value = "" Me.txtdivision.Value = "" Me.txtlocation.Value = "" Me.txtsystemname.Value = "" Me.Txtpurpose.Value = "" Me.txtaccess.Value = "" Me.txtdatecompleted.Value = "" 'set option button to input data based on type of information to column 5 With ws If OptElectronic Then .Cells(EorP, 5).Value = "Electronic" Else .Cells(EorP, 5).Value = "PaperBased" End If End With 'set option button to input data based on personal data into column 7 With ws If PersonalYes Then .Cells(EorP, 7).Value = "Yes" Else .Cells(EorP, 7).Value = "No" End If End With 'set option button to input data based on privacy notes into column 8 With ws If PrivacyYes Then .Cells(EorP, 8).Value = "Yes" Else .Cells(EorP, 8).Value = "No" End If End With End Sub 'combo button setup Private Sub UserForm_Activate() ComboStatus.Clear With ComboStatus 'this loads the combo .AddItem "" .AddItem "Live" .AddItem "Archived" .AddItem "zzz" End With End Sub 'close button on the form Private Sub cmdClose_Click() Unload Me End Sub