I have a macro that's running quite well and is cross-posted here:
What I need to do is allow for user input. I want to create a dialog box that pops up and asks for an input range, when the user runs the macro. Values can only be from 1 - 50. And the user won't be allowed to select broken sequences, like 6, 9, 12-15.
They would have to be continuous, i.e. 6 - 15, etc. I'm still very new to VBA. I can play with the control toolbox, but I have very little understanding of how to interface with the components that I'm adding/creating. Once I have that range, I want to use the inputs as the 'start' and 'stop' points for my loop. So I need to capture the values and pass them as input parameters, I'm guessing.
I can modify the loop to accept the inputs, I'm just not sure how to capture them from a user input dialog box.
I am trying to create a macro which gives me an input box. I need to enter 2 numbers into the input box. It would be as follows:
Input Box Msg 1 - "What is your labor cost?" (NUM1) Input Box Msg 2 - "What is your productivity rate?" (NUM2)
Then I need the macro to take this info and enter it into a formula which changes according to the row which you are on. (I need the macro to work based on which ever cell I currently have selected). The formula would be this if I currently had a cell on row 10 selected:
So, if I currently had cell L10 selected, and I ran the macro and put 100 in for "NUM1" and 10 for "NUM2" and my sheet had 20 in cell H10, then the macro would enter the number 1,000 into cell L10. If I had L500 selected, then the macro would enter the final number into cell L500 based on what value H500 contained.
I have attached a spreadsheet example. I would like to be able to use a command button to pop up a series of questions for the user to input a value and have that value populate the directed cell.
Example from spread sheet:Click - "How many bid" button First question should be " How many for Joe" Input the number i.e. 2 The number input should go to the cell C5 in this example Next question should be "How many for John" I want to input the number 3 The number 3 should go into cell F5 How many for Jim I need to input a number The number should go to cell I5 How Many for Jerry I need to input a number The number should go to cell L5
I would also like the same function for the "How many won" button.
I have made a sheet with 10 input boxes, some for text and some for numbers. If you make a mistake now you must click though the rest of the questions to start again and make a change. Is there a way to add a back button that would take you to the last question? Or possibly make the cancel button stop all questions? Here is a sample of the code
Code: Private Sub Worksheet_Change(ByVal Target As Range) Dim strname As String If Target.Address = Range("k11").Address Then
I have this macro in which the user clicks a button and it formats a file for them. I want a box next to the button where the user can enter a number first then click the button and then the file will use that number to calculate a column. Any help is appreciated.
For example part of my macro is this.
Lcol = Range("IV5").End(xlToLeft).Column + 1 Cells(5, Lcol) = "Total Cost" Worksheets("sheet1").Range("u6").Formula = "=IFERROR((RC[-1]/RC[-3])*the number the person entered first,0)" Lrow = Range("A" & Rows.Count).End(xlUp).row Range("u6").AutoFill Destination:=Range("u6:u" & Lrow), Type:=xlFillDefault With Range("u6:u" & Lrow) .Copy .PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:= _ False, Transpose:=False End With Application.CutCopyMode = False
I'm using the following code to create an Inputbox but I want to either disable the OK button until an entry is made or not allow a blank entry. Forcing the user to have to make an entry.
If NameTextBoxnew.Value = "" Then NameTextBoxnew.Value = Application.InputBox("You must input a name/nickname to identify person", "Name") End If If SexTextBoxnew.Value = "" Then SexTextBoxnew.Value = Application.InputBox("You must select a sex(m/f)", "Sex") End If If DOBTextBoxnew.Value = "" And AgeTextBoxnew.Value = "" Then AgeTextBoxnew.Value = Application.InputBox("Please insert a rough age in years", " Date of RSIT") End If
I am just starting to get my feet a little damp with VBA and I am trying to make a macro that will act whenever any text is entered in any cell within a 3x3 square. Whenever any text is entered in any of those cells I would like it to enter a text ( "X" ) in a cell which is specified by a cell in the spreadsheet (this cell will output which cell the macro should write the text in in this format "A:1" or "C:3"). How can I make the program act only in reaction to the user entering thier text, and also, how can I get the macro to read A:1 and enter the text into that specific cell? Any help would be so awesome, the book I have is really difficult to navigate.
I am wanting to create a push button function with a query attched that will allow the user to input certain criteria with the end result in sorting the column containing the criteria.
I have attached a sample of my form:
My desire is the user will have the ablity to push the button and a input box will appear and they will be able to enter the data to search for. And the column with sort showing only the information required.
What I am having difficulties with is creating the pop-up input box. A simple macro with a sort or filter will not work as the data criteria is not the same everytime.
I am an absolute beginner to Excel programming and new to this forum. After I have been reading some basics I think this is absolutely the right place to learn
What I am trying to do i to use a userform for input in list. Should be simple, but I can't figure it out
Attached there is a sheet that I set up. The sheet called "Source" contains some data that is used as a picklist in the input form. I created a user form called "Newflight" with comboboxes in which you can input plane type, pilot and passenger based on the data in the Source sheet. It also contains an input box for the take off time. (it would be very nice if I the actual time could be entered by a single click, but the user should still be able to enter it manually). After clicking "STORE" the data should be stored in the first empty row in the sheet called "List".
My new Time in Motion sheet is coming along nicely with some snazzy programmed Command Buttons to fill data into another sheet.
One of my buttons is for 'other' tasks, so I'd like to programme a button to prompt first for a number of minutes (e.g. 30), and then a brief description (e.g. Meeting) and input the data side-by-side in 2 columns on sheet 2.
This is what I have for my other single-entry buttons, so what would I need to add?
Dim ans As String ans = InputBox("Case reference:", "Data Entry") Sheets("Sheet2").Range("F" & Sheets("Sheet2").Range("F" & Rows.Count).End(xlUp).Row + 1).Value = ans
Is there any way I use the same userform and somehow change the 'input' cell to the next row down each time the userform is selected..
I have a macro button, which when clicked opens a userform, an option button is selected and that value is put into a cell in a certain column.
However, as shown in the grid below, theses macro buttons are the same all the way down the column, and lead to the same userform, so instead of creating hundreds of the same userform is there a way of changing the cell number (row) when the next macro is pressed??
I have a series of Userforms that I would like the user to be forced to enter in some sort of information in one of those userform in the series. I do not want it to be submitted blank. Is there a code or a properties toggle to make this possible.
How would I go about making a user form that has an input box where you can type in a year (in yyyy format), and then two radio buttons that allow you to choose either "Jan-Jun" or "Jul-Dec", and a submit button to run a corresponding macro.
The purpose of this is I have two macros that run the same report, one is for first half of the year, second is for second half of the year. For simple purposes we will call them "JanJun" macro and "JulDec" macro ...
I have a userform that has Label 1, textbox1 and textbox2 at the top. (I shall call it HEADER)
Then, arranged in a row i have combobox1, textbox4, textbox6, textbox7 and label7 (I shall call LINE1)
On a row beneath this i have combobox2, textbox12, textbox14, textbox15 and label 10 (I shall call LINE2)
I need a way of finding the first empty row on sheet 1 (easy bit) and then putting the info from the HEADER and LINE1 in the first empty row, then HEADER and LINE2 in the next empty row etc etc. There are 5 rows in total
So I have a workbook (Workbook1) that opens a userform on launch. I have another workbook (Workbook2) that has a button to open Workbook1. Upon opening Workbook1 (and as a result the userform) I'd like to input data from Workbook2 into the fields of the userform. I'm not exactly sure how to reference the userform fields to input data from Workbook2.
I'm trying the following code:
With Workbooks(Workbook1).Userform1 UserformField1 = "Billy" UserformField2 = "John" End With
The macro is opening Workbook1 and the userform but the fields return blank.