-1
我想要一個幫助我在空行添加信息的用戶表單。但是,在被填充的行之間找到空行。例如,第2行是空的,而第1行和第3行是填充的。因此,我需要一個能夠遍歷所有行並且無論哪行都爲空的代碼,它將由用戶表單輸入填充。 我只設法出來這個代碼,但它只適用於列的每一行。在填充行之間的新行中添加信息
Private Sub CommandAddButton1_Click()
lastrow = Sheets("Programme Status Summary").Range("J" & Rows.Count).End(xlUp).Row
Cells(lastrow + 1, "J").Value = TextBoxProjCode.Text
Cells(lastrow + 1, "E").Value = TextBoxProjName.Text
Cells(lastrow + 1, "C").Value = TextBoxSegment.Text
Cells(lastrow + 1, "F").Value = TextBoxSummary.Text
Cells(lastrow + 1, "G").Value = TextBoxAcc1.Text
Cells(lastrow + 1, "H").Value = TextBoxAcc2.Text
Cells(lastrow + 1, "I").Value = TextBoxProjM.Text
Cells(lastrow + 1, "K").Value = TextBoxCountry.Text
Cells(lastrow + 1, "L").Value = TextBoxRegulatory.Text
Cells(lastrow + 1, "M").Value = TextBoxRiskLvl.Text
Cells(lastrow + 1, "P").Value = TextBoxSchForecast.Text
Cells(lastrow + 1, "R").Value = TextBoxSchPar.Text
Cells(lastrow + 1, "S").Value = TextBoxImpact.Text
Cells(lastrow + 1, "T").Value = TextBoxCustNonRetail.Text
Cells(lastrow + 1, "U").Value = TextBoxCustRetail.Text
Cells(lastrow + 1, "V").Value = TextBoxOutsourcingImp.Text
Cells(lastrow + 1, "W").Value = TextBoxListImpt.Text
Cells(lastrow + 1, "X").Value = TextBoxKeyStatus.Text
Cells(lastrow + 1, "N").Value = TextBoxSchStart.Text
Cells(lastrow + 1, "O").Value = TextBoxSchEnd.Text
Cells(lastrow + 1, "Y").Value = TextBoxRagStatus.Text
Cells(lastrow + 1, "Z").Value = TextBoxRagCost.Text
Cells(lastrow + 1, "AA").Value = TextBoxRagBenefit.Text
End Sub
我希望任何人都可以幫助我。會真的很感激它。謝謝。