KestutisTower
New Member
- Joined
- Jun 2, 2022
- Messages
- 23
- Office Version
- 2016
- Platform
- Windows
Hello!
I have a code that transfers data from userform to datasheet.
it transfers data to table:
line 8 in, the code ads values to a cell values in column J. What I need is to Also add value of coresponding cell in column E. So cell value in J1 would show " akiniai 1 vnt. juodi - 15 ", J2 - " suknele 1 vnt. xl zalia - 25 " and so on.
I have a code that transfers data from userform to datasheet.
VBA Code:
Sub Submit()
Dim sh As Worksheet
Dim iRow As Long
Set sh = ThisWorkbook.Sheets("Pardavimai")
iRow = [Counta(Pardavimai!A:A)] + 1
With sh
.Cells(iRow, 1) = UserForm1.txtVardas.Value
.Cells(iRow, 10) = UserForm1.txtPreke.Value & " " & UserForm1.txtKiekis.Value & " vnt." & " " & UserForm1.txtKomentaras.Value & " - "
.Cells(iRow, 11) = [Text(Now(), "DD-MM-YYYY")]
.Cells(iRow, 2) = UserForm1.txtPreke.Value
.Cells(iRow, 3) = UserForm1.txtKiekis.Value
.Cells(iRow, 4) = UserForm1.txtKomentaras.Value
.Cells(iRow, 6) = UserForm1.txtVienetoKaina.Value
End With
End Sub
it transfers data to table:
Book111.xlsm | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | K | |||
1 | Pirkėjas | Prekė | Kiekis | Komentaras | Bendra kaina | Vieneto kaina | LT kaina | Pelnas | Rita/Loreta | Pilnas | Data | ||
2 | kestas | akiniai | 1 | juodi | 15 | 15 | akiniai 1 vnt. juodi - | 2022.06.10 | |||||
3 | rita | suknele | 1 | xl zalia | 25 | 25 | suknele 1 vnt. xl zalia - | 2022.06.10 | |||||
4 | kestas | maike | 1 | xxl | 5 | 5 | maike 1 vnt. xxl - | 2022.06.10 | |||||
5 | kestas | kremas | 1 | 2 | 2 | 2 | kremas 1 vnt. 2 - | 2022.06.09 | |||||
6 | rita | lankelis | 1 | zalias | 7 | 7 | lankelis 1 vnt. zalias - | 2022.06.10 | |||||
7 | rita | kremas | 2 | ranku | 4 | 2 | kremas 2 vnt. ranku - | 2022.06.11 | |||||
Pardavimai |
Cell Formulas | ||
---|---|---|
Range | Formula | |
E2:E7 | E2 | =F2*C2 |
line 8 in, the code ads values to a cell values in column J. What I need is to Also add value of coresponding cell in column E. So cell value in J1 would show " akiniai 1 vnt. juodi - 15 ", J2 - " suknele 1 vnt. xl zalia - 25 " and so on.