Formatting 20+ Text Boxes On A Form
Mar 30, 2009Currently I'm using this:
View 9 RepliesCurrently I'm using this:
View 9 RepliesI have a userform with 40 text boxes in it. I have learnt how to restrict people entering anything other than numbers into a text box using the following code on the keypress property of the textbox:
Const Number$ = "0123456789." ' only allow these characters
If KeyAscii 8 Then
If InStr(Number$, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
Rather than have 40 of these blocks of code (one for each text box), is it possible to somehow group them so that a block of code is applicable to all of them?
For the sake of arguement, the textboxes are called data1 up to data40
I have a user form with 4 text boxes and a command button. I have no problem looping through the textboxes to retrieve the value, but what is the best way to detect if any duplicates exist between the four text boxes? For example, in the command button's
If textbox one's value is "test" and textbox four's value is also "test", it should throw an exception. If a question like this has already been answered, a link to that post would surely suffice.
I am trying to create a user form to edit some named ranges. The VBA user form designer is basically the same as Borland Delphi, so building the form itself was easy. What I can't figure out is how to populate the user form with the data from the spreadsheet.
I have a number of text boxes on the form with names like txtTier1Slots, txtTier1Ceiling, txtTier1Floor, etc up to 4.
I have a defined name that corresponds with each item, Tier1Slots, Tier1Ceiling, Tier1Floor, and so on. I'm using defined names because they're referenced in Conditional Formatting on one of the worksheets in my project. They don't exist as actual cells, just name references.
I want to get the form populated with those values. I've tried about twenty variations of the following code, using ThisWorkbook, Workbooks, Cells, Range, Name, and just about every cell reference method I can think of. I've so many different error messages, my head is spinning.
I have a user form which includes some text boxes (txtRUL.text for example) where I want to enter a number as a percentage. I divide the number entered by 100 to avoid Excel automatically multiplying by 100 and the result is displayed in the user form as the correct percentage.
Private Sub txtRUL_AfterUpdate()
EnableSave
txtRUL.Value = Format(txtRUL.Value / 100, "0.0%")
(I'm sorry I cant figure out how to format this code as code in this post)
This works well, trouble is when I save and it writes the results to the worksheet, the numbers in the user form revert back to plain unformatted non percentage numbers (ie 5% goes to 0.05)
I need to create a form that if you were to enter a name in the text box it would fill all the information across that row into other boxes on the form. Basicly if I type John Doe in the text box it would look in col A for John Doe and then put whats in the cells on that row into different boxes on my form. I have tried searching but I have had no luck. Im very new to forms so this is a great experience.
View 3 Replies View RelatedIm designing a form which will be a few list boxes that input data into specific cells in another sheet.
I would like the list boxes to change depending on selection.
eg: if there is a certain value selected in the first list, then only the relevant values will appear in the second box.
so if there are values Potato, Banana and Apple in list one, and list two contains values White, Yellow and Red.
if banana is clicked in list 1 then only yellow will appear in box 2 as a selection.
I am looking to connect 2 form control boxes and have the second box run 2 different types of macros. The first box will have only 2 options - select by week and select by month.
The second box should show the list of weeks or months based on the selection in the first box. Then for the second box, if weeks is shown, a week macro should be run whenever a week date is selected. Similarly for the list of months, a month macro should be run whenever a month is selected.
I have been trying to do this for more than a week (after posting on this board) without success. I apologize if this seems like a duplicate post.
I'm trying to link two combo boxes via a user form. I'm trying to select a city in one combobox which in turn would provide a listing of zip codes for that particular city in the next combobox.
View 6 Replies View Relatedthis is my first attemp at doing a "userform". I am looking for some help in creating a user form that enables users to choose items from drop down boxes, which shows next level drop down list items, then down to final drop down list with information based on first two choices. I've attached the sample file for reference.
View 3 Replies View RelatedI am creating a spreadsheet where the user enters food they have eaten that day. The way this is done at the moment is with validated list boxes, one depending on the other using the indirect function. I want to be able to make this into a user input form. Is there a way of adding these validations from the spreadsheet, to an input form.
I want the input form to have an input for the day, food group, food item, and quantity of the food. The food item needs to depend on the food group.
I need to establish a method of interleating multiple dropdowns or Form Control boxes. The purpose is to select one item and have a selection of multiple items associated with the selected item. Example:
Computer training dropdown box 1 offers selections of word, excel, powerpoint, ... If selection is Word, then dropdown box#2 offers advanced in room #15, Intermediate in room #16, Beginning in room #17. If Box 1 selection is excel box 2 selections would be different.
I am working on a check box based list for work. The requirement is for the check box to be linked to the cell that it is in and then for conditional formatting to be done so that if the box is checked it goes green and if it is blank it goes red. This is fine for individual cells, but when i try and copy the formatting and cells throughout the worksheet it links all the cells back to the original cell.
View 7 Replies View RelatedI am creating an income calculation sheet to qualify my borrowers. I have different "types" of income in regards to hourly pay, bonus pay and overtime pay (examples)
I am using check boxes for my worksheet for the income that my underwriters want to use (example OT plus regular pay or Bonus plus regular pay or just regular pay alone can all be different options) they would then just check the box for the combo they want to use. (my check boxes came from the developer tab and I have them formatted to show true/false for checked or unchecked.)
Intro to my problem: We have 3 separate time frames for each type of pay. (I have 2012 Bonus, 2013 Bonus and then 2014 year to date bonus.....and the same for Overtime pay and regular pay, etc.)
My underwriters can only use ONE of the 3 yearly options.
Excel problem: Im thinking I need to go conditional formatting for this, but I need something to pop up if they accidentally have 2 boxes checked in one category. (So if they accidentally mark a box to use 2012 OT AND 2014 OT year to date, thats a problem and will throw the #'s off) So Im thinking there is some way to conditionally format my true/false results from my check boxes. If 2 out of 3 say true, the cell should black out or something along those lines....
I attached a screen shot of how my worksheet looks as of now : Income example excel forum.docx‎
Basically I have a list of companies each with five corresponding check boxes in different cells. I want the cell with the company name in (or just a symbol in the cell) to appear Green, Amber, Red when 5, 3-4, 1-2 of the boxes are checked respectively.
View 3 Replies View RelatedI have a couple of excelfiles in which someone made a flowchart with text boxes. I would like a search code that would help me find a text or number in those text boxes. The CTRL+F function only works on cells. Does something similar exist for text boxes? Or can this be made in a macro?
Trying to Find a specific word and Replace with another within a textbox ( created from the drawing tool, as well as the control toolbar) The textboxes contain loads of text information.
as an example
The word "Apple" to be replaced with "Orange"
I came across this code from the archives (compliments of Dave Hawley)
Sub ReplaceTextBoxText()
Dim sTextBox As Shape
Dim wSheet As Worksheet
Set wSheet = Sheets.Add()
For Each sTextBox In Sheet1.Shapes
I've tried several variations with no results. (perhaps it's to extensive for my modest needs)
For example:
Locking a certain text boxes, and not others. Under review, protect sheet, the Edit Objects function is all or nothing
I m creating new tabs that users input into a text box and two label: one each becuase one tab will be Tab1 then then other label will be Tab1 Completed.
How do you continously update the label so it changes as the user inputs letters.
I never used text boxs before so thus another reason I have no clue.
Am trying to use a VLOOKUP in VBA on a form, I am entering data in one field so data will be displayed in another field. They are both text boxes. Here is the code;
View 3 Replies View RelatedI have 10 Text boxes each, on many tabs of a Multipage. I have a Private Sub LoadRow() for one tab.Is there a way to use a Sub that would work for each tab or do I have to write a new sub for each tab? Here’s the sub I’m using.
Private Sub LoadRow()
txtTrussco.Text = Cells(lCurrentRow, 1).Value
txtTPhone.Text = Cells(lCurrentRow, 2).Value
txtTFax.Text = Cells(lCurrentRow, 3).Value
txtTAddress.Text = Cells(lCurrentRow, 4).Value
txtTCity.Text = Cells(lCurrentRow, 5).Value
txtTState.Text = Cells(lCurrentRow, 6).Value
txtTZipcode.Text = Cells(lCurrentRow, 7).Value
txtTSalesrep.Text = Cells(lCurrentRow, 8).Value
txtTSrepphone.Text = Cells(lCurrentRow, 9).Value
txtTrusseng.Text = Cells(lCurrentRow, 10).Value
End Sub
I have a ton of text boxes on a userform that are in an initial state of being disabled. Is there a quick way of enabling by use of a mask for these Text Boxes ?
All the text boxes I want to enable are named "TB_fieldname" and by mask I mean a snippet of code using something like "TB_*"
Example
tb_liqname, tb_casecost, tb_bottleprice etc etc..
I may be doing this wrong, but I have a form that i created using Active X controls in Excel 2007 (I couldn't use the form control text box, it was greyed out). I have textbox1, textbox2 etc... I got the form to work but I can't tab through. When the user is done entering data in textbox1, I want to set the focus to textbox2. i would like this to happen with enter and tab.
View 9 Replies View RelatedI have been working on an excel sheet with several text boxes that need data manually putting into them. I have set the texts boxes out in the correct order and could tab thru them perfectly in order, but then I saved, closed then reopen the document and now the text boxes do not tab in order. I have tried to rearrange them, delete them and start again but the same problem happens every time and I cannot get the tab order of the text boxes to stay in order
View 24 Replies View RelatedI am trying to combine the text from the comments boxes of a full row of cells into the comments box of a separate other cell in order to provide an overview of the comments in these cells in one place.
View 2 Replies View RelatedHow can I link two text boxes in excel so the text can flow from one to another?
View 2 Replies View RelatedI have files where empty textboxes have been copied over tens if not hundreds of times, thereby slowing down the scrolling speed immensely.
I would be interested if there was a macro to
a) select all empty text boxes
b) select and delete all empty text boxes
I am wondering if the user can use 2 boxes to search and populate the record.
Ie./ Box 1= Vehicle Registration Box 2= Date
This sheet will be used throughout each month and each vehicle registration may have more than one record that month
So I need the user to be able to input the vehicle reg and for the form to populate the relevant record.
I current have a Unique reference which is a combo box that once you select it auto populate the record but this will take forever having to populate ach record to find which one the user is looking for.
I have a file that another person created and instead of traditionally saving, the only way to save file is by hitting X in top right corner and then a series of boxes pop up directing the user on what to do. I looked at macros within file and couldn't find anything really relating to the saving functions of document. This is a complex document and I'm starting to think that it isn't a macro. Is there any area in excel that allows you to adjust save settings? All I'm trying to do is change the wording in these pop up boxes but cannot find the source. Attached is screen shot of first box that pops up.
View 4 Replies View RelatedI made up a form of 30 text boxes to simplify entering data, but seem to be having a problem inserting it easily back into my excel file.
I would like to use a simple Do While loop to shorten my code but can't seem to change my text box correctly.
My text boxes all have names like this txtap1run11, txtap1run12, txtap1run13...
As you can see all I need to do is change the last number of the text box name.
I can't figure out how to do that though. I came up with this, I don't have the do while loop in.