Hi All,
I'm new to the Visual Basic in Excel.
I'm trying to do the next thing, I have a lot of textboxes and comboboxes,
Now i need the data from them or i add the data of them to strings.
I Have different pages and on every page you got some boxes.
This is what i want to do
But i also need to do the next for another page
So only the XXX and ZZZ differ i'm looking for a function or a code that i don't have to copy paste everything and make my code more cleaner.
Thanks in advance
I'm new to the Visual Basic in Excel.
I'm trying to do the next thing, I have a lot of textboxes and comboboxes,
Now i need the data from them or i add the data of them to strings.
I Have different pages and on every page you got some boxes.
This is what i want to do
Code:
Gegevens = txtAbcZZZ "," txtCbaZZZ
Workbooks.Open ("R:\08 Pack\Student\Automatisatie\Compleetfinito.xlsm")
RowCount = Workbooks("Compleetfinito.xlsm").Sheets("Incidenten").Range("A1").CurrentRegion.Rows.Count
With Worksheets("Incidenten").Range("A1")
.Offset(RowCount, 0) = Datum
.Offset(RowCount, 1) = DatumMaand
.Offset(RowCount, 2) = DatumWeek
.Offset(RowCount, 3) = txtIncZZZ.Value
.Offset(RowCount, 4) = cboAuteurZZZ.Value
.Offset(RowCount, 5) = "Pu"
.Offset(RowCount, 6) = "ZZZ"
.Offset(RowCount, 8) = cboProbleemZZZ.Value
.Offset(RowCount, 7) = txtMateriaalNummerZZZ.Value
.Offset(RowCount, 9) = txtHoeveelheidZZZ.Value
.Offset(RowCount, 10) = "stuks"
.Offset(RowCount, 11) = txtOpmerkingenZZZ.Value
.Offset(RowCount, 12) = Gegevens
End With
ActiveWorkbook.Save
ActiveWorkbook.Close
But i also need to do the next for another page
Code:
Gegevens = txtAbcXXX "," txtCbaXXX
Workbooks.Open ("R:\08 Pack\Student\Automatisatie\Compleetfinito.xlsm")
RowCount = Workbooks("Compleetfinito.xlsm").Sheets("Incidenten").Range("A1").CurrentRegion.Rows.Count
With Worksheets("Incidenten").Range("A1")
.Offset(RowCount, 0) = Datum
.Offset(RowCount, 1) = DatumMaand
.Offset(RowCount, 2) = DatumWeek
.Offset(RowCount, 3) = txtIncXXX.Value
.Offset(RowCount, 4) = cboAuteurXXX.Value
.Offset(RowCount, 5) = "Pu"
.Offset(RowCount, 6) = "XXX"
.Offset(RowCount, 8) = cboProbleemXXX.Value
.Offset(RowCount, 7) = txtMateriaalNummerXXX.Value
.Offset(RowCount, 9) = txtHoeveelheidXXX.Value
.Offset(RowCount, 10) = "stuks"
.Offset(RowCount, 11) = txtOpmerkingenXXX.Value
.Offset(RowCount, 12) = Gegevens
End With
ActiveWorkbook.Save
ActiveWorkbook.Close
So only the XXX and ZZZ differ i'm looking for a function or a code that i don't have to copy paste everything and make my code more cleaner.
Thanks in advance