Hi,
I'm working on a UserForm that entering / updating sales data must simplify.
My knowledge of VBA is minimal, so I try here and there some information and codes from the internet to pick and stick together.
In attached file you can see how far I am.
If there are any comments or regarding the design please let me know.
Entering new data is no problem with the form, but now I want to build something so I can update existing records or supplement.
Here is where I got stuck.
I found a piece of code that retrieves data from an existing worksheet.
I have to change the code so that the record is found based on the date and store.
The formula I think I should use to find the row number is: MATCH (K1 &K2; data_datum & data_winkel, 0)
where cell K1 and K2 must be replaced by values of the labels of the corresponding labels of the userform (DTPicker1 and ComboBox1).
This concerns an array formula.
But I have no idea how implement this in my VBA code.
Can anyone help me?
The relevant code that I think should be changed is:
I'm working on a UserForm that entering / updating sales data must simplify.
My knowledge of VBA is minimal, so I try here and there some information and codes from the internet to pick and stick together.
In attached file you can see how far I am.
If there are any comments or regarding the design please let me know.
Entering new data is no problem with the form, but now I want to build something so I can update existing records or supplement.
Here is where I got stuck.
I found a piece of code that retrieves data from an existing worksheet.
I have to change the code so that the record is found based on the date and store.
The formula I think I should use to find the row number is: MATCH (K1 &K2; data_datum & data_winkel, 0)
where cell K1 and K2 must be replaced by values of the labels of the corresponding labels of the userform (DTPicker1 and ComboBox1).
This concerns an array formula.
But I have no idea how implement this in my VBA code.
Can anyone help me?
The relevant code that I think should be changed is:
Code:
Private Sub UserForm_Activate()
Dim ActiveR As Long
Dim aCell As Range
Dim aRow As Long [COLOR=#FF0000]
ActiveR = MATCH(DTPicker1.Value&ComboBox1.Value;data_datum&data_winkel;0)[/COLOR]
FindValue = Sheets("DataInput").Cells(ActiveR, 1).Value
TextBox1.Value = Sheets("DataInput").Cells(ActiveR, 3).Value
TextBox2.Value = Sheets("DataInput").Cells(ActiveR, 4).Value
TextBox3.Value = Sheets("DataInput").Cells(ActiveR, 5).Value
End Sub