Страницы: 1
RSS
Автонумерация первой строки через созданную форму
 
Здравствуйте, подскажите пожулуйста, как изменить данный код, чтоб первый текстбокс заполнялся автоматически, при том что уже есть заполненные сроки
Код
Private Sub CommandButton2_Click()Set sht = Sheets("1")
N = sht.Range("A1").CurrentRegion.Rows.Count
sht.Cells(N + 1, 1).Value = TextBox1.Text
sht.Cells(N + 1, 2).Value = TextBox8.Text
sht.Cells(N + 1, 3).Value = TextBox9.Text
sht.Cells(N + 1, 4).Value = TextBox10.Text
sht.Cells(N + 1, 5).Value = TextBox7.Text
sht.Cells(N + 1, 6).Value = TextBox6.Text
sht.Cells(N + 1, 7).Value = TextBox20.Text
sht.Cells(N + 1, .Value = TextBox19.Text
sht.Cells(N + 1, 9).Value = TextBox17.Text
sht.Cells(N + 1, 10).Value = TextBox18.Text
sht.Cells(N + 1, 11).Value = TextBox16.Text
sht.Cells(N + 1, 12).Value = TextBox15.Text
sht.Cells(N + 1, 13).Value = TextBox14.Text
sht.Cells(N + 1, 14).Value = TextBox13.Text
sht.Cells(N + 1, 15).Value = TextBox12.Text
sht.Cells(N + 1, 16).Value = TextBox11.Text
sht.Cells(N + 1, 17).Value = TextBox25.Text
sht.Cells(N + 1, 18).Value = TextBox24.Text
sht.Cells(N + 1, 19).Value = TextBox23.Text
sht.Cells(N + 1, 20).Value = TextBox22.Text
sht.Cells(N + 1, 21).Value = TextBox21.Text
sht.Cells(N + 1, 22).Value = TextBox38.Text
sht.Cells(N + 1, 23).Value = TextBox37.Text
sht.Cells(N + 1, 24).Value = TextBox36.Text
sht.Cells(N + 1, 25).Value = TextBox35.Text
sht.Cells(N + 1, 26).Value = TextBox34.Text
sht.Cells(N + 1, 27).Value = TextBox33.Text
sht.Cells(N + 1, 28).Value = TextBox32.Text
sht.Cells(N + 1, 29).Value = TextBox31.Text
sht.Cells(N + 1, 30).Value = TextBox30.Text
sht.Cells(N + 1, 31).Value = TextBox29.Text
sht.Cells(N + 1, 32).Value = TextBox28.Text
sht.Cells(N + 1, 33).Value = TextBox27.Text
sht.Cells(N + 1, 34).Value = TextBox26.Text
sht.Cells(N + 1, 35).Value = TextBox40.Text
sht.Cells(N + 1, 36).Value = TextBox41.Text
sht.Cells(N + 1, 37).Value = TextBox39.Text
 
TextBox1.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox7.Text = ""
TextBox6.Text = ""
TextBox20.Text = ""
TextBox19.Text = ""
TextBox17.Text = ""
TextBox18.Text = ""
TextBox16.Text = ""
TextBox15.Text = ""
TextBox14.Text = ""
TextBox13.Text = ""
TextBox12.Text = ""
TextBox11.Text = ""
TextBox25.Text = ""
TextBox24.Text = ""
TextBox23.Text = ""
TextBox22.Text = ""
TextBox21.Text = ""
TextBox38.Text = ""
TextBox37.Text = ""
TextBox36.Text = ""
TextBox35.Text = ""
TextBox34.Text = ""
TextBox33.Text = ""
TextBox32.Text = ""
TextBox30.Text = ""
TextBox29.Text = ""
TextBox28.Text = ""
TextBox27.Text = ""
TextBox26.Text = ""
TextBox40.Text = ""
TextBox41.Text = ""
TextBox39.Text = ""
TextBox31.Text = ""
End Sub
 
Можете файл пример приложить?
 
http://www.cyberforum.ru/vba/thread2441851.html ? да, забыла, данная тема еще тут
думаю что первую строчку нужно изменить. но не понимаю как
Код
sht.Cells(N + 1, 1).Value = TextBox1.Text
Изменено: DKe - 24.04.2019 10:54:58
Страницы: 1
Наверх