Добрый день многоуважаемые форумчане!!! Прошу вас помочь разобраться с последней моей задачей чтоб начать работу для весовой службы... При внесении данных на UserForm1 и нажатием кнопки внести данные. Данные заносятся в журнал но с лишь одной не корректной деталью (((( [img][/img] Хотя предыдущие записи отображаются как нужно (хотя оператор вносил эти значения через запятую) Почему происходит данная ошибка??? [vba]
Код
Private Sub Butt_ok_Click() 'Данный код для записи данных в нужные нам ячейки в таблицу на листе "Журнал прихода" Dim LastRow As Long LastRow = Cells(Rows.Count, 1).End(xlUp).Row If TextBox1.Value <> "" Then Cells(LastRow + 1, 1) = TextBox1.Value If TextBox2.Value <> "" Then Cells(LastRow + 1, 23) = TextBox2.Value If TextBox3.Value <> "" Then Cells(LastRow + 1, 21) = TextBox3.Value If ComboBox1.Value <> "" Then Cells(LastRow + 1, 5) = ComboBox1.Value If ComboBox2.Value <> "" Then Cells(LastRow + 1, 2) = ComboBox2.Value If ComboBox3.Value <> "" Then Cells(LastRow + 1, 24) = ComboBox3.Value If ComboBox5.Value <> "" Then Cells(LastRow + 1, 6) = ComboBox5.Value If ComboBox4.Value <> "" Then Cells(LastRow + 1, 4) = ComboBox4.Value If ComboBox6.Value <> "" Then Cells(LastRow + 1, 3) = ComboBox6.Value If ComboBox7.Value <> "" Then Cells(LastRow + 1, 25) = ComboBox7.Value If ComboBox8.Value <> "" Then Cells(LastRow + 1, 26) = ComboBox8.Value If TextBox4.Value <> "" Then Cells(LastRow + 1, 22) = TextBox4.Value If TextBox5.Value <> "" Then Cells(LastRow + 1, 10) = TextBox5.Value If ComboBox9.Value <> "" Then Cells(LastRow + 1, 27) = ComboBox9.Value If TextBox6.Value <> "" Then Cells(LastRow + 1, 7) = TextBox6.Value If TextBox7.Value <> "" Then Cells(LastRow + 1, 8) = TextBox7.Value If TextBox8.Value <> "" Then Cells(LastRow + 1, 13) = TextBox8.Value If TextBox9.Value <> "" Then Cells(LastRow + 1, 20) = TextBox9.Value Unload Me End Sub
[/vba] Может в коде обозначить формат??? Прошу прощения файл не прилагаю слишком уже здоровый даже если я (и поудалюю все не нужное)
Добрый день многоуважаемые форумчане!!! Прошу вас помочь разобраться с последней моей задачей чтоб начать работу для весовой службы... При внесении данных на UserForm1 и нажатием кнопки внести данные. Данные заносятся в журнал но с лишь одной не корректной деталью (((( [img][/img] Хотя предыдущие записи отображаются как нужно (хотя оператор вносил эти значения через запятую) Почему происходит данная ошибка??? [vba]
Код
Private Sub Butt_ok_Click() 'Данный код для записи данных в нужные нам ячейки в таблицу на листе "Журнал прихода" Dim LastRow As Long LastRow = Cells(Rows.Count, 1).End(xlUp).Row If TextBox1.Value <> "" Then Cells(LastRow + 1, 1) = TextBox1.Value If TextBox2.Value <> "" Then Cells(LastRow + 1, 23) = TextBox2.Value If TextBox3.Value <> "" Then Cells(LastRow + 1, 21) = TextBox3.Value If ComboBox1.Value <> "" Then Cells(LastRow + 1, 5) = ComboBox1.Value If ComboBox2.Value <> "" Then Cells(LastRow + 1, 2) = ComboBox2.Value If ComboBox3.Value <> "" Then Cells(LastRow + 1, 24) = ComboBox3.Value If ComboBox5.Value <> "" Then Cells(LastRow + 1, 6) = ComboBox5.Value If ComboBox4.Value <> "" Then Cells(LastRow + 1, 4) = ComboBox4.Value If ComboBox6.Value <> "" Then Cells(LastRow + 1, 3) = ComboBox6.Value If ComboBox7.Value <> "" Then Cells(LastRow + 1, 25) = ComboBox7.Value If ComboBox8.Value <> "" Then Cells(LastRow + 1, 26) = ComboBox8.Value If TextBox4.Value <> "" Then Cells(LastRow + 1, 22) = TextBox4.Value If TextBox5.Value <> "" Then Cells(LastRow + 1, 10) = TextBox5.Value If ComboBox9.Value <> "" Then Cells(LastRow + 1, 27) = ComboBox9.Value If TextBox6.Value <> "" Then Cells(LastRow + 1, 7) = TextBox6.Value If TextBox7.Value <> "" Then Cells(LastRow + 1, 8) = TextBox7.Value If TextBox8.Value <> "" Then Cells(LastRow + 1, 13) = TextBox8.Value If TextBox9.Value <> "" Then Cells(LastRow + 1, 20) = TextBox9.Value Unload Me End Sub
[/vba] Может в коде обозначить формат??? Прошу прощения файл не прилагаю слишком уже здоровый даже если я (и поудалюю все не нужное)lebensvoll
Я думал можно так это сделать (((( но код сразу красным становится (((( видать снова не так мыслю ((( [vba]
Код
If ComboBox5.Value <> "" Then Format(Cells(LastRow + 1, 6),"#.0#" = ComboBox5.Value
[/vba] а вот если так вот то не ругается ))) [vba]
Код
If ComboBox5.Value <> "" Then Format(Cells(LastRow + 1, 6), "#.0#") = ComboBox5.Value
[/vba] Но это также не решило проблемы (((( Прошу вас подскажите в чем ошибки или почему так происходит вот я вношу данные так [img]http://[/img] а как получается в первом сообщении
Я думал можно так это сделать (((( но код сразу красным становится (((( видать снова не так мыслю ((( [vba]
Код
If ComboBox5.Value <> "" Then Format(Cells(LastRow + 1, 6),"#.0#" = ComboBox5.Value
[/vba] а вот если так вот то не ругается ))) [vba]
Код
If ComboBox5.Value <> "" Then Format(Cells(LastRow + 1, 6), "#.0#") = ComboBox5.Value
[/vba] Но это также не решило проблемы (((( Прошу вас подскажите в чем ошибки или почему так происходит вот я вношу данные так [img]http://[/img] а как получается в первом сообщенииlebensvoll
Кто бы ты ни был, мир в твоих руках
Сообщение отредактировал lebensvoll - Среда, 10.08.2016, 14:38
На первой картинке выдает то, что заказали. В верхних строках после первых 2-х цифр стоит запятая (в первом и втором весе), в нижней строке запятых нет. Попробовал ваш файл - нормально строку добавил, т.е. веса с запятыми указал. Поэтому непонятно в чём проблема.
На первой картинке выдает то, что заказали. В верхних строках после первых 2-х цифр стоит запятая (в первом и втором весе), в нижней строке запятых нет. Попробовал ваш файл - нормально строку добавил, т.е. веса с запятыми указал. Поэтому непонятно в чём проблема.Udik
вот вам барабан яд 41001231307558 wm R419131876897 udik1968@gmail.com
Сообщение отредактировал Udik - Среда, 10.08.2016, 15:09
Private Sub Butt_ok_Click() 'Данный код для записи данных в нужные нам ячейки в таблицу на листе "Журнал прихода" Dim LastRow As Long LastRow = Cells(Rows.Count, 1).End(xlUp).Row If TextBox1.Value <> "" Then Cells(LastRow + 1, 1) = TextBox1.Value If TextBox2.Value <> "" Then Cells(LastRow + 1, 23) = TextBox2.Value If TextBox3.Value <> "" Then Cells(LastRow + 1, 21) = TextBox3.Value If ComboBox1.Value <> "" Then Cells(LastRow + 1, 5) = ComboBox1.Value If ComboBox2.Value <> "" Then Cells(LastRow + 1, 2) = ComboBox2.Value If ComboBox3.Value <> "" Then Cells(LastRow + 1, 24) = ComboBox3.Value If ComboBox5.Value <> "" Then Cells(LastRow + 1, 6) = ComboBox5.Value If ComboBox4.Value <> "" Then Cells(LastRow + 1, 4) = ComboBox4.Value If ComboBox6.Value <> "" Then Cells(LastRow + 1, 3) = ComboBox6.Value If ComboBox7.Value <> "" Then Cells(LastRow + 1, 25) = ComboBox7.Value If ComboBox8.Value <> "" Then Cells(LastRow + 1, 26) = ComboBox8.Value If TextBox4.Value <> "" Then Cells(LastRow + 1, 22) = TextBox4.Value If TextBox5.Value = Cells(LastRow + 1, 1) = Format(TextBox5.Value, "#.0#") <> "" Then Cells(LastRow + 1, 10) = TextBox5.Value If ComboBox9.Value <> "" Then Cells(LastRow + 1, 27) = ComboBox9.Value If TextBox6.Value = Cells(LastRow + 1, 1) = Format(TextBox6.Value, "#.0#") <> "" Then Cells(LastRow + 1, 7) = TextBox6.Value If TextBox7.Value = Cells(LastRow + 1, 1) = Format(TextBox7.Value, "#.0#") <> "" Then Cells(LastRow + 1, 8) = TextBox7.Value If TextBox8.Value <> "" Then Cells(LastRow + 1, 13) = TextBox8.Value If TextBox9.Value <> "" Then Cells(LastRow + 1, 20) = TextBox9.Value Unload Me End Sub
[/vba]
но результат не дал своих плодов ((((( да почему же на одних компах он работает как нужно на других все не так ((((
[img][/img]
doober, если я правильно понял то так??? [vba]
Код
Private Sub Butt_ok_Click() 'Данный код для записи данных в нужные нам ячейки в таблицу на листе "Журнал прихода" Dim LastRow As Long LastRow = Cells(Rows.Count, 1).End(xlUp).Row If TextBox1.Value <> "" Then Cells(LastRow + 1, 1) = TextBox1.Value If TextBox2.Value <> "" Then Cells(LastRow + 1, 23) = TextBox2.Value If TextBox3.Value <> "" Then Cells(LastRow + 1, 21) = TextBox3.Value If ComboBox1.Value <> "" Then Cells(LastRow + 1, 5) = ComboBox1.Value If ComboBox2.Value <> "" Then Cells(LastRow + 1, 2) = ComboBox2.Value If ComboBox3.Value <> "" Then Cells(LastRow + 1, 24) = ComboBox3.Value If ComboBox5.Value <> "" Then Cells(LastRow + 1, 6) = ComboBox5.Value If ComboBox4.Value <> "" Then Cells(LastRow + 1, 4) = ComboBox4.Value If ComboBox6.Value <> "" Then Cells(LastRow + 1, 3) = ComboBox6.Value If ComboBox7.Value <> "" Then Cells(LastRow + 1, 25) = ComboBox7.Value If ComboBox8.Value <> "" Then Cells(LastRow + 1, 26) = ComboBox8.Value If TextBox4.Value <> "" Then Cells(LastRow + 1, 22) = TextBox4.Value If TextBox5.Value = Cells(LastRow + 1, 1) = Format(TextBox5.Value, "#.0#") <> "" Then Cells(LastRow + 1, 10) = TextBox5.Value If ComboBox9.Value <> "" Then Cells(LastRow + 1, 27) = ComboBox9.Value If TextBox6.Value = Cells(LastRow + 1, 1) = Format(TextBox6.Value, "#.0#") <> "" Then Cells(LastRow + 1, 7) = TextBox6.Value If TextBox7.Value = Cells(LastRow + 1, 1) = Format(TextBox7.Value, "#.0#") <> "" Then Cells(LastRow + 1, 8) = TextBox7.Value If TextBox8.Value <> "" Then Cells(LastRow + 1, 13) = TextBox8.Value If TextBox9.Value <> "" Then Cells(LastRow + 1, 20) = TextBox9.Value Unload Me End Sub
[/vba]
но результат не дал своих плодов ((((( да почему же на одних компах он работает как нужно на других все не так ((((