User Forms Basics - Text Boxes To Named Range
Sep 24, 2009
User Form Basics - Populating Text Boxes. A few tweaks later and its reading the data just fine. Some of the specific form objects and range names have changed, but it's the same logic.
Anyway, this isn't just for display. I need to export the data back to the spreadsheet. So, I plugged this line into the event handler for the "Save & Exit" button on the sample form in the other thread:
View 2 Replies
ADVERTISEMENT
Sep 23, 2009
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.
View 6 Replies
View Related
Feb 17, 2007
How can i populate a forms listbox from another workbooks named range? ....
View 9 Replies
View Related
Jun 13, 2009
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.
View 2 Replies
View Related
May 1, 2008
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)
View 9 Replies
View Related
May 3, 2008
On the first row of a spreadsheet template is a <hidden> contiguous series of conditionally formatted cells (range name "stdRow" =production!$1:$1), with formulas, that I want a user to be able to easily insert at whatever row they might be in a worksheet.
If, for example, the user is at D24, then clicks the [InsertRow] button that I have positioned at the top of the worksheet (in a fixed pane), I want the attached macro to insert an instance of "stdRow" directly underneath the user position (at row 25, in this case). The use's position should still be at D24 when the macro finishes. If the user clicks the button multiple times, multiple rows should be inserted (again, without changing the user's position).
This is what I have tried so far:
View 13 Replies
View Related
Dec 4, 2012
Passing Named Range into User Defined Function
MrExcel.com | Excel Resources | Excel Seminars | Excel Products mcm91201
Depending on time of day and computer I am sitting in front of I am using:
WinXP Pro SP2 with Excel 2003
Win7 Pro SP2 Excel 2007
Win7 Pro SP2 Excel 2010 on PC
Win7 Pro SP2 Excel 2010 on Mac Mini running Boot Camp
OSX Excel for Mac 2011
I have only tried this on Win7 Pro SP2 Excel 2007 but need it to work on all.
I enter the values 0, 1, 2 ... 89, 90 in cells A1 to A91
I select A1:A91 and name the range 'angle'
I create a user defined function:
Public function sindeg(value As Double) as Double
sindeg = sin(worksheetfunction.radians(value))
end
I want 'value' for the function in a cell to be replaced by the corresponding value in the same row (or column) in the named range 'angle'. For example (using commas as column separators). This works for Excel functions like sin, cos, radians, etc.
********** Worksheet Contents **********
A1 = 00, B1 = sin(radians(0)), C1 = sin(radians(A1)), D1 = sin(radians(angle)), E1 = sindeg(0), F1 = sindeg(A1), G1 = sindeg(angle)
A2 = 01, B2 = sin(radians(1)), C2 = sin(radians(A2)), D2 = sin(radians(angle)), E2 = sindeg(1), F2 = sindeg(A2), G2 = sindeg(angle)
A3 = 02, B3 = sin(radians(2)), C3 = sin(radians(A3)), D3 = sin(radians(angle)), E3 = sindeg(2), F3 = sindeg(A3), G3 = sindeg(angle)
......
A91 = 90, B91 = sin(radians(90)), C91 = sin(radians(A91)), D91 = sin(radians(angle)), E91 = sindeg(90), F91 = sindeg(A91), G91 = sindeg(angle)
Column A = input. Columns B, C, D, E and F all calculate the same value by row. Column G fails with a #VALUE. In row 1 the value of angle[1] = 0 therefore column D = C = B = sin(0) = 0. In row 2 angle[2] = 1 therefore B = C = D = 0.017452
How can I get the user defined function sindeg(value) in column G to accept the named range variable 'angle' like the Excel function radians(value) accepted it in column D?
This functionality should work horizontally as well as vertically. For example enter 'angle' A1 to CM1 then have sindeg(angle) filled from A2 to CM2. It should also work in the case where the named range 'angle' is a single cell.
I am sure that this is a simple variable type definition problem in my user defined function: should the input variable be defined as type Range? Or something more exotic?
The brute force approach is to have the function determine the input value by passing in the named range, working out dimensions, calculating offset between the cell the function is in and top (left) of named range, then counting down (right) to pick the correct value. However I cannot see adding all that code to EVERY function. Occam's Razor says there has to be an easier way since Excel built in functions seem to do it readily.
View 8 Replies
View Related
Nov 7, 2008
So I have a work book with a number of user forms. One form I have completed has several navigation buttons (previous, save, next......) a couple of drop downs and a "tabbed" (pages) area with a text box on each. I think I finally have it looking (and working) the way I want. The issue is I need 12 more that are Identical (different text - but layout and code is the same) To make them look and work the same how can I copy the one I have correct? Is Export/Import the way to go? Does that bring all the code?
View 3 Replies
View Related
Nov 18, 2008
Excel 2003
VBA on user forms
View 5 Replies
View Related
Nov 21, 2006
I am trying to graduate out of the crayon age of menus on a worksheet, to using a User Form Menu. Problem is, I don't understand how they work. I've created a test program using a simple form with an option button, a combo button, and a command button. The goal is if the option button is true, it places the color selected in the combo button on the worksheet. Here is my code, what am I missing to make it work?
Corrected code from my original request
Module 1
Public ClrCd As Integer
Sub OpenForm1()
UsrFrm1.Show
End Sub
View 9 Replies
View Related
Feb 28, 2009
My problem is trivial but annoying. When I initiate my user form, one of the check boxes has a dashed border around the outside as if it was selected. No matter what I try, I cannot get the form to initialize without effecting this box. If I delete the box and recreate it, another box simply inherits this problem.
I have attached the spreadsheet, please Click the button over "A1" to see what I mean if you have the time.
View 2 Replies
View Related
May 26, 2009
I have a userform, when it first comes up, then there are some text boxes that needs to be filled. I have the "ok" button which opens another form. What would be the code for whatever was filled in the text box be pasted in a cell? In other words, once it is ok is clicked another form pops up and then whatever info was put in the text boxes is pasted in a report.
View 4 Replies
View Related
Jun 6, 2009
I have the following three codes repeated in five different User Forms,
Is there a way to put them all in one independent module?
View 14 Replies
View Related
Nov 28, 2006
I have 2 User forms which take their initial values from the same worksheet. One moves stock to another location, the other removes stock when it has been used.
When I use one of the forms on a different row, or switch to the other form it retains the last row's values until I click on the new worksheet row twice
How can I prevent this?
Private Sub CommandButton17_Click()
If UserForm5.Visible = True Then
Unload UserForm5
End If
If ActiveCell.Row = 1 Then
MsgBox "Cannot Use This Row, Choose A Different One"
Exit Sub
End If
UserForm4.Show vbModal
End Sub
Private Sub CommandButton18_Click()
If UserForm4.Visible = True Then
Unload UserForm4
End If
If ActiveCell.Row = 1 Then
MsgBox "Cannot Use This Row, Choose A Different One"
Exit Sub
End If
UserForm5.Show vbModal
End Sub
I won't post the form code here yet as both are quite large. Maybe someone has encountered this issue before?
View 9 Replies
View Related
Mar 14, 2007
I am making a user form so that others can enter their data into a database.
In some of the fields I want to have a drop down list that will contain both all the options from a generic list, and any other items that have previously been entered into that field. For example I have a generic list of components but someone may feel that none of those listed describe their component so they will add a new one, I want this new one to then appear within the drop-down list for the next user,
View 9 Replies
View Related
Oct 25, 2007
I have a spreadsheet with the following headings:
A
Claims Number
B
Name
C
Scheme
D
Admin
E
Date
I need to create a user form that will "pop up" and ask the administrator to enter the above details.
A - should be created automatically (ie last claim number + 1)
B - user enters manually
C - data retrieved from a list
D - data retrieved from a list
E - date is the date the information is entered
View 9 Replies
View Related
Jan 9, 2007
I am using a calendar control 11 in a user form. I would like to create a combobox on a user form that when you click the drop down button it opens the calender then the user can select a date which is then returned to the combobox. I beleive the way to do this is to trap the dropbuttonclick event. Tho it dosent seem to work.
Private Sub ComboBox2_DropButtonClick()
Calender.Show
ComboBox2.Value = Calender.Calendar1.Value
End Sub
View 5 Replies
View Related
Mar 19, 2007
In VBA i have 3 userforms, the first 2 take the data and store them in variables. The 3rd form is supposed to take the variables from the other two forms and do some calculations with them. Although i cant get the 3rd form to take the stored variables from the other two forms. Is there a way to use stored values from other userforms?
View 3 Replies
View Related
Feb 16, 2010
Is there a way to save items into memory to be recalled in userforms.
Let's assume that I have a userform called UserForm1 and three textboxes named TextBox1, TextBox2 and TextBox3.
View 9 Replies
View Related
Oct 4, 2007
I have a tiny problem with a bug in excel. You see, if you try to enter an empty range into a line graph you will error out. Well, I can't guarentee that the range will have at least one value in the macro so I was thinking that I would initalize a range varable (say ProductXRange) to an error message that reads: "ERROR: Selected Product Data is Not Available." Thus by guarenteeing me an entry no matter what. The question I have is because the string is not on a worksheet, how do I force it into the range varable (ProductXRange)? I.E. ProductXRange would in reality have one entry...the error massage.
View 9 Replies
View Related
Jan 8, 2014
I've got a workbook set up. One tab has a bunch of named ranges, let's say Tables 1-6. The second tab has vlookups for selected values from a sharepoint data pull (in order to parse through the sharepoint stuff, most of it is nonsense).
What I am trying to do is write a formula for cell E2 that:
-Step 1: Looks into whichever range the user specifies, 1-6 (probably using the indirect function).
-Step 2: Searches the specified range for text found in cell F2 (a string of text with values from one or more of the ranges 1-6)
-Step 3: Returns the text.
View 2 Replies
View Related
Nov 6, 2012
I have a speadsheet where I have a cell that reads a named range via OFFSET. The range consists mainly of numbers but a few cells contain the text UL (Unlimited)
The cell that "reads" the OFFSET is then used in another cell where it is multiplied by either 2 or 3 depending on user input.
The problem occurs where the cell attempts to multiply the text "UL" which results in "#VALUE!"
How can I have this cell with the multiplication bypass the multiplication and simply return the text "UL" in the case of reading text from the named range.
View 2 Replies
View Related
Feb 18, 2009
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 Related
Nov 30, 2009
Attached is an example of what I'm looking for. Example: Column A has all the month names with a defined named range of crnt. D6 has a data validation display with a value of Nov 09, I need E6 to display Oct 09 automatically from the data in Column A. Basically I need cell E6 to always display the previous months text based off cell D6. I think the example sheet explains it better.
View 2 Replies
View Related
Sep 29, 2009
this 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 Related
Apr 28, 2014
How to set up a Inputbox to make the user pick the start line and end line for a loop
the sheet will have items on it numbered 1,2,3,etc I want a process done to the lines the user selects by item number not cell range.
line 4 to line 20 for example.
View 4 Replies
View Related
Aug 24, 2009
I have some dynamic named ranges in sheet1, and in sheet2 I have data validation dropdown list which has the names of all the DNR's in it.
What I want it to do (in sheet3, no less) is for the user to be able to pick a named range from the dropdown list, and have a particular column in sheet3 then display that entire named range.
I have made a 'data' worksheet which is the source for the data validation in sheet2. Each item in the list identically matches the name of each of the named ranges. I was hoping to be able to use some form of =INDIRECT but alas, no such luck.
So it's almost like a copy and paste function I'm after, where:
If you pick "Schedule_From" out of the DD-list, then DNR 'Schedule_From' is what is pasted in Column B in Sheet3.
DON'T want to use a PivotTable.
View 9 Replies
View Related
Jul 24, 2009
I wrote some code that toggles bewtweeen the word "Yes" and the function clearcontents.
What it does not do, is if you click on cell A1 and change it's contents and you click on the same cell again it does nothing. You need to click on another cell say A2 before you can go and change A1 again.
My code is as follows:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("Documents")) Is Nothing Then
On Error Resume Next
Application.EnableEvents = False
If IsEmpty(Target) Then
Target.Value = "Yes"
Else
Target.ClearContents
End If
Application.EnableEvents = True
On Error Goto 0
End If
End Sub
View 3 Replies
View Related
Aug 16, 2014
Let's say you have a named range, Rng1, which consists of cells A1 & A2. In vba how would you report back what, if any, named range the following cells resides:
Code] .....
here are multiple named ranges so using intersect is not feasible. Essentially, through code, I will be given a range and I need to determine if that range if part of a named range.
View 5 Replies
View Related
Jul 27, 2007
I have a little knowledge of Excel Programming and I am seeking advice and help. With reference to the http://www.exceltip.com/st/Create_Us...Excel/629.html, I managed to create the form but I somehow couldn’t get it executed. Attached herewith my file for evaluation.
View 14 Replies
View Related