Hello Everyone,
This is my first post as a member and I have frequented MrExcel quite often in the past week as my new research project requires a lot of VBA and I am very unfamiliar with the code.
I am trying to create a search function that can search for different compounds based off of properties and allow the user to specify the upper and lower limits of the properties for which they are searching for. As a result, I created a user form with 4 radio buttons that allow the user to specify if they want the value to be 'less than', 'equal', 'greater than', or 'between' a value that they specify in a textbox.
So if the user selects the 'less than' radio button the function is supposed to search for anything that is less than the user specified value from the database. I am currently unable to get my program to work and i think my if statements for the radio dials might be incorrect.
prop1option is the searched term that I am using in my find function. Any advice on the following string of code would be greatly appreciated!
This is my first post as a member and I have frequented MrExcel quite often in the past week as my new research project requires a lot of VBA and I am very unfamiliar with the code.
I am trying to create a search function that can search for different compounds based off of properties and allow the user to specify the upper and lower limits of the properties for which they are searching for. As a result, I created a user form with 4 radio buttons that allow the user to specify if they want the value to be 'less than', 'equal', 'greater than', or 'between' a value that they specify in a textbox.
So if the user selects the 'less than' radio button the function is supposed to search for anything that is less than the user specified value from the database. I am currently unable to get my program to work and i think my if statements for the radio dials might be incorrect.
prop1option is the searched term that I am using in my find function. Any advice on the following string of code would be greatly appreciated!
Code:
Dim prop1option as Variant
If ILsearch.P1B1.Value = True Then
prop1option = (prop1option < ILsearch.TextBox1.Value)
End If
If ILsearch.P1B2.Value = True Then
prop1option = (prop1option = ILsearch.TextBox1.Value)
End If
If ILsearch.P1B3.Value = True Then
prop1option = (prop1option > ILsearch.TextBox1.Value)
End If
If ILsearch.P1b4.Value = True Then
prop1option = (prop1option > ILsearch.TextBox1.Value) And (prop1option < ILsearch.TextBox2.Value)
End If