如何避免我的编码不保存活动工作表上的数据?

我正在写一本名为“数据”和“日报”的工作簿。 我只是希望我的代码在日常工作表中保存新的input,而不是这样做,它保存在活动sheet.I将不胜感激,如果有人可以解决这个问题。

这是我的代码:

Private Sub CommandButton1_Click() 'Saving Button Dim sonsat As Long sonsat = Sheets("Daily").Cells(Rows.Count, 1).End(xlUp).Row + 1 Call Main 'Progress Bar Cells(sonsat, 1) = TextBox1 Cells(sonsat, 2) = TextBox2 Cells(sonsat, 3) = TextBox3 Cells(sonsat, 4) = TextBox4 Cells(sonsat, 5) = TextBox5 MsgBox "Registration is successful" ListBox1.List = Sheets("Daily").Range("A2:E" & Cells(Rows.Count, 1).End(xlUp).Row).Value 'For refresh listbox TextBox14.Value = ListBox1.ListCount End Sub 

尝试以这种方式添加对日常工作表的引用:

 With Sheets("Daily") .Cells(sonsat, 1) = TextBox1 'dot at the beginning is very important... .Cells(sonsat, 2) = TextBox2 .Cells(sonsat, 3) = TextBox3 .Cells(sonsat, 4) = TextBox4 .Cells(sonsat, 5) = TextBox5 end with