I am trying to get my userform to search a worksheet for data.
In "A" I have a vehicle name (Audi, BMW etc) these names occur more than once
In "B" I have the vehicle model.
i.e:
A B
Audi A3
Audi A4
Audi A6
BMW X5
BMW M3
I would like to be able to have a command button on my userform (preferable one for each vehicle type) that the user can click on to then add the list of relevant vehicle models into a combo box.
i.e Click on the Audi command button and the combo box displays all the models in "B" that have Audi in "A"
I have a spreadsheet on sheet 1 with a list of customers and their information. So on column A I have the customer number (i.e. k968, e37, p528,...), on column B i have the customer's name, on column C the street's name, on Column D the house number, on column E the zip code and finally the city on column F.
Right now there are around 600 customers in this list.
I have made a userform with a combobox in which I want to select an existing customer (pulled from the spreadsheet). On the same userform I have textboxes (customer number, name, street, number, zip, city). When I select a customer in the combobox, I want this customer's info to show up in the textboxes. I want to be able to change the info and hit Next to store the changes in the spreadsheet. When I do not select a customer from the combobox, I want to add new info in the textboxes and hit Next to store this info as a new customer. The userform also has a delete button. Then I select a customer in the combobox, this customer (and it's info) should be deleted from the spreadsheet when i hit Delete. So the spreadsheet is variable in length.
I'm coming along nicely with my user form. My last issue was trying to get it to search/recall data from the "Data" tab. This works perfectly when only 1 record is found, and if multiple line items are found, a message box pops up and tells me how many records are found that meet the criteria. However, I am now struggling to get the code to work properly to past the details of those records into the list box, so that the user can select which record they want to edit.
I get a Run-Time Error '1004' Application-Defined or Object-Defined error and it points to the section in red:
Code: Sub FindAll() Dim strFind As String 'what to find Dim rFilter As Range 'range to search Set rFilter = Worksheets("Data").Range("E3", Range("h65536").End(xlUp)) Set Rng = Worksheets("Data").Range("E3", Range("e65536").End(xlUp)) strFind = Me.cbosearch.Value
I currently have a search and insert data userform which finds specific data from the textbox and displays the results in a listbox. Then I can select a specific result in the listbox and insert this data into a selected worksheet row. The problem is that the userforms code is out-of- date, i have changed to workbook to a point that the userform doesn't work properly. What i need is a new userform that can do the same thing but with the code simpler to change in case of new updates. Here is some information what is needed:
The data that userform gets information from is on a different Workbook called Database.xls, Worksheet called Data and the Range is A:E. The Data is Product Information which is in the Columns A to E:
A = Product Number (The format is 000-000-00) B = Product Name (No format is Text) C = BA (The Format is 00) D = Price (The Format is £0.00) E = PQTY (The Format is General)
The Textbox needs to be able to search two different Columns A and B and also their representing formats. For example able to search for the product name or number which formats are 000-000-00 or 00000000. The Listbox needs to show the Datas formats like 000-000-00 and £ 0.00. The Insert button needs to insert a selected row from the lisbox results and insert the Product Number from that row into a selected worksheet row cell which is in Column J. This is the existing code and example.xls if you want some more information on what i need:
Private Sub cmdInsert_Click() Dim X As Long, ws As Worksheet, i As Long, ii As Integer Set ws = ActiveSheet ws.Unprotect ("seasons") With ActiveSheet X = ActiveCell.Row End With With Me.ListBox1 For i = 0 To .ListCount If .Selected(i) Then ws.Cells(X, 10) = .List(i, 0).............
I work in a small team of 5 people, but each of us is very busy and get emails from our manager asking us to complete different tasks. I have made a userform in excel for our manager to create the tasks in and put all the details in sheet1. This creates each separate task on a separate row. Now I want each of my colleagues to log into the sheet and be able to retrieve a task with the same userform. I am giving each task it's own ID, so I want to be able to search by this and the userform will be populated with the task details. I also have combobox's with the status of each task (Completed, In progress etc.) I want to be able to change these in the userform too.
VB: Private Sub UserForm_Click() Private Sub CommandButton1_Click() Dim LastRow As Object Set LastRow = Sheet1.Range("b65536").End(xlUp)
I need a code for vinculating a user form and perform some searchings on a excel database. For further details see attached file.
I created a user form in which some infromation is requested in order to search on excel database, I need a macro to search, display and update this data/information.
As an example, if i need to find the part number "C23138810-1" using the button search database and contains or match options, then displays all the information on the user form, this information is located in the same row where the part number is. Then, if some change is required, update is by clickig button "Update Data", and then if require "find next" item to review or update.
I am a green as green can be beginner to VBA coding. My question is, I created a text box on my user form so the user can input a 'billing code' and when they hit submit on the user form, the vba will search the spreadsheet and land on the data entered in the text box.
I have been able to make a excel sheet which takes inputs from userform for First Name, Last Name, Address etc. I have included a duplicate check for column "B" for "First Name". This checks if any existing data is already which matches the new data input for "First Name" through userform.
The userform only checks for the "First Name" check as required and gives a message that duplicate has been found. Then I have to close the userform and do a Control Key+F ( to find the new name for example, James) in excel sheet and validate that new name is same or different from existing name "James". This I want to do since this new name "James" may be another "James" as his "Last Name" is different. So even though First Name is same, since Last Name is different I know they are two different persons. In that case I will add the entry manually in sheet, instead of userform, since I would not be able to input the new data for "James" since the duplicate check with the current code will not allow me to do so.
What I am current trying is -
1. If the new name say "James" is entered through userform, then excel should point me to the existing row where the record for existing name "James" is there, say row 4.
2. Now without closing userform I should be able to see in the background excel sheet the search results for "James", as excel is pointing to that now. There may be multiple "James" in the existing which should be pointed out.
3. Based on the results that I see in the background excel sheet I can now decide that, this new name "James" is different from old "James" (of row 4) since his Last Name is different. Accordingly excel code should then ask me to add this record or discard this new record.
4. Duplicate check for First Name is enough for me. I would not require "Last Name" duplicate check.
I hope I have been able to explain my problem. I have also attached my current code as I am not able to attach any sample test file.
I have a workbook with 4 worksheet that store different type of data. It also has a userform that load at start of the application which is to search the data in the workbook. The userform has a combobox where the names of the sheets are stored. when the user selects say Sheet2 in the combobox, it enables the relevant textboxes on the userform and activates the worksheet at the change event. The userform has a search button that searches all the worksheets based on the text entered in a textbox.
The problem: how to search based on 1 textbox. What I want is: say for e.g the end-user selects sheet2 from the combobox, this intern enables 4 textboxes (Name, DOB, Nationality, ID #) on the userform. The end-user should have the liberty to enter data in 1 and/or any of the textboxes. The search should be performed, that if data is only in 1 of any of textboxes then give all rows that fit that criteria and display in a temp worksheet. if say the name and dob is filled by the user than what matches both should be displayed in a temp worksheet. if say dob, name and ID# given so the search button should narrow down to fit all 3 criteria and then display result in temp worksheet. As if mentioned data can be entered in either just 1 or any or all textboxes.
E.g. the worksheet is (Columns are Name, Nationality, DOB, ID#)
row 1 = name: Steven Martin, DOB: 27-may-1993, Nationality: Trinidad & Tobago, ID #: 1234567 row 2 = name: Gary Richards, DOB: 2-FEB-1993, Nationality: British, ID #: 456789 row 3 = name: David Cohen, DOB: 27-May 1993, Nationality: American, ID #: 98765 row 4 = name: Roberto McDonalds, DOB 21-Jul-1962, Nationality: British, ID # 654321 row 5= name: Gary Richards, DOB: 01-Dec-1978, Nationality: Australian, ID # 1234567
Now if the user enters only name as "Gary Richards" and search then row 2 and 5 should be displayed in a temp worksheet. if user enters name Roberto McDonald and ID# 1234567 then it should not display anything. if user enters DOB 27-may-1993 and nationality British and ID # 1234567 then as well shouldn't display anything and should a msgbox "no data found".
I have 2 option buttons and 3 userforms. The passage between those userforms are made with "next/back" command buttons.
Options buttons are € and $ and they are in the first userform.
If the user make a choice between € and $ in the userform1, the following macro plays
If Me.Dollar Then Sheets("Data").Range("B2").Formula = "$" Else Sheets("Data").Range("B2").Formula = "€" End If Problem
The other 2 userforms contains texts that depends on the choice made in the first userform/option buttons (€ or $)
Private Sub UserForm_Initialize() Application.ScreenUpdating = False Text1.Caption = Worksheets("Data").Range("B2").Value Text2.Caption = Worksheets("Data").Range("B2").Value Text3.Caption = Worksheets("Data").Range("B2").Value End Sub
so in theory userform initialize should change the text and get what s written in Data Sheet.B2 cell automatically and INSTANTLY. But it only gets the initial choice and when I go back/forward between userforms and even change the € to $ or vice versa the inital choice remains in the next userforms.
I want to make a user form that works as a password box. I have UserForm1 which is my "Menu" and I created UserForm2, which is my password entry form. The problem I have is that once I click "go" on my password box (which works fine), the Password Box closes but the user form remains open. I want the user form to close as well when I click "Go". So, my password box should close both UserForm1 and UserForm2.
Here is my code:
Private Sub cmdPasswordGo_Click() Dim UserName, Password As String UserName = txtUserName.Text Password = txtPassword.Text If UserName = "Chad" And Password = "Pass01" Then Unload Me Else: MsgBox "Your authentication cannot be validated" End If End Sub
My issue is that once UserForm2 is "unloaded", UserForm 1 is "active" but I cannot simply "Unload Me" again, I get an error.
i have a userform which displays a textbox which shows a variance in price terms based on a sheet which has live data via dde.
I would like to turn this userform into some kind of floating monitor if possible. At the moment - once you fire up the userform - the price in the textbox is fixed and does not change with the cell which fills the textbox on the userform. The only way is if you close the userform and re-open - then you will see the current price. I would like to keep this userform floating so that you can still select other cells on the sheet. Is this possible?
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_Click()
End Sub
Private Sub UserForm_Initialize() With ThisWorkbook.Sheets("price").Range(ActiveCell.Address) If .Value = "" Then Range("D31").Select Me.TextBox1.Value = "No Trade Selected"...................
I have below code for prevent to close a user form:
[Code] ....
But this work to me only one time, when i make a second press on close button user form close. I think i have to make a loop or something but i really don't now how?
I am trying to make my textbox on the userform equal a cell value in a column. I need the userform to look at the last cell that has a value in a column and display that value into the textbox on the userform.
Ex. I am starting my data from Cell "O8" and the last possible row would be "O51" Starting with O8 I need my textbox in the userform to read this cell value. After each entry the next row in Column O will have a value, so I would need my userform textbox to read cell "O9" value the next time the user form opens. Here is what I got thus far:
[Code].....
It gives me a Compile Error: Invalid or unqualified reference.
I have constructed a user form with a set of comboboxes containing a number of choices. However, the different alternatives depend on each other, and instead of having all the choices available in the second combobox I would like to only have the "correct" ones depending on the choice made in the earlier combobox.
For example; --------------- A-B-C Car-Blue-USA Car-Red-USA Truck-Green-Sweden Truck-Blue-Sweden
If I choose Car in the first combobox, I would like to only have the choices [Blue, Red] available in the second combobox, not the full set of data [Blue,Red,Green] and so on. However, I have two problems construction this;
1) If I make the rowsource A1-A4 for the first combobox, I get the alternative [Car,Car,Truck,Truck], not [Car,Truck]. It is possible to come around this problem by making a unique list in addition to the linked list showed above, such as;........
I have put calendar in my form and I want it to be visible only if I click on the combobox and make it invisible when date gets filled in the combobox.
I wrote the following code but it gives me runtime error -2147417848(80010108) Automation error :The object invoked has disconnected from its clients.
I am trying to make a userform that will update a list in the spreadsheet. Basically if a user types into a multiline textbox numbers (separated by line) like so:
5 10 15 20
then the macro will paste that data at the end of a list so that each number is in a new cell. The only thing I have that comes close is Range("A1").value = listbox1.value The problem with this is that it will input the entire list into one cell. I have attemped various things, like trying to get the list into the clipboard and pasting, but I haven't really had much luck.
When you create a userform in the vba editor, then go to another module, then return to the userform, you see the userform object by default and in order to show the code you have to right-click on the userform and select "view code".
How can I make the "view code" view the default view for the form in the VBA editor? (i.e. so that when the form is selected, I am presented with the code, not the object).
With the use of the option buttons,the page needs to made visible or invisible.
Example: on Page one, i have placed radio buttons as page2,Page3&page4.
By default only page 1 should be visible and when we select radio button page2, page2 should become visible or else it should be invisible,when we select radio button page3, page3 should become visible or else should remain invisible.
I have written a code that acts as a directory search engine for peoples names. There is a form called search that is loaded and asks the user which name he or she would like to search for. When the user enters the data, whether the name is spelled right or not, the search finds the first closest match to whatever was entered into the form. I would like to change this in one way. Many times there are people with the same first name but different last name or two very similar first names that might be highlightes instead of the exact name the user is looking for. I would like to ask if anyone knows how to write a code that would insert each of the names that have all or part of the entered name into a forms box to where a final selection could be made to select the exact row of cells that the user wants to see. This is much like the find feature on your PC. You enter what you want to find and it brings up all of the things that include your keywords and you make the final selection. Is this possible or just very complicated? This is the current search code that I have written. It will find the closest match but will not insert it into a form
Sub FindIt() Dim FDescriptions As Range Dim Reply As Long MysName = Search.Textbox1 Set FDescriptions = Columns(4).Find(What:=MysName, Lookat:=xlPart, LookIn:=xlValues)
If FDescriptions Is Nothing Then Reply = MsgBox("Food Not In Database. Try Again?", vbYesNo) If Reply = vbYes Then Search.Show Else FDescriptions.EntireRow.Activate End If End Sub
Using the search macro code below, could someone please help to add in more codes what I'm currently using, and also where to insert it. The Search function works well for what I need and it helps me to locate data. When using the search function somehow it search all sheets within the workbook but I only want it to search an array of sheets when using this macro that is needed to complete the task for what I'm after.
Macro Public Sub FindText() 'Run from standard module, like: Module1.
Dim ws As Worksheet, Found As Range, rngNm As String Dim myText As String, FirstAddress As String, thisLoc As String Dim AddressStr As String, foundNum As Integer
myText = InputBox("Enter the text that you want to search for:", "Start Search!")
I have a userform for data entry. I am able to make codes for Add ( Add entry to database), clear ( Clear userform ) , Cancel (Exit userform). I have some more buttons and functions to be assigned to them but not able to write code .
Need codes for :
1) Have search box which searches Mat id in the complete database and returns value in the search result listbox. When we click on the result in listbox , the userform values are filled with the values that the mat id has . Then if user wishes he can update teh details for that mat id , and click on update button . the data is updated in the database. Or he can delete the entry from database by clicking on delete button.
2) Have arrows which will navigate through database ( need macros for that ) .
I have a standard multi-page excel workbook in Excel 2013. I have built a user form that will allow for user input into my main excel page. This inpu includes many different variables, including one called "Paint". The value of paint can currently be selected from a drop down box that pulls its values from a spreadsheet in the workbook (Paint!A$1,A$50) but here's the issue. I have over 50 possible values for paint and it makes the drop box time searching for the right one kinda hard.
Here's what I want to do: Have a button beside the paint drop-down that says "Search", When the users clicks it it opens a search dialogue of some kind that will return the closest values to their search. When they click the value they want it gets entered as the selected value for the "Paint" drop-down box.
Here's my questions: -Is this even possible ?I know enough about VBA to know that this is probably difficult in which case id still like to try. -If it is possible. Are there perhaps any places you could point me to that would have some sort of starting point for me to work from. Remember I got the other part already I just need the search functionality.
Not sure if I am linking this correctly but here it goes...http://www.excelforum.com/excel-prog...ification.html
This is a previous post link that is now solved but I have a new question based on the code in the post. I would like to know how to add a search and update ability to the user form I have created. I am newb with user forms so I apologize in advance for my lack of knowledge.
And yes I know the way it is set up now it is depositing data in two different locations; this is for a specific purpose.
I am looking to create a userform that submits data to my spreadsheet.The fields should be Reference Number, Title, forename, surname and DOB.The filling in of the reference number is compulsory, and should display a message box if a reference number has not been input.A button should be present on the spreadsheet that brings the userform up.
The search Userform should look the same as the input userform, except the fields are blanked out and uneditable.
The ability to search by any field is neccesary.
A list should be brought up containing the search results.
The user can then select the entry that they are looking for and then the uneditable userform comes up with the information that has be extracted from the existing entries.y impossible.