Moving Control Between Userforms And Worksheets
Aug 10, 2006
"how do you move control/focus between Userforms and a worksheet that has Control objects on it?"
Here's what I am trying to do... I have created a Workbook that is basically a database and uses several Userforms to allow users to enter data into the database. I then have various CommandButtons in the Userforms that are intended to extract information from the database (which is stored in a worksheet) and display that information on a newly created worksheet. What I want to do is have a CommandButton on the new worksheet (the new worksheet is called "Results") that when pressed will delete the Results worksheet and return control to the Userform that created it.
So, the basic steps are:
* Display the Userform with the show method
* On the _click event of a particular Command button, Add a new worksheet
* Fill the worksheet with the pertinent data
* Place a Command button on the new worksheet and call it "Close"
* Somehow transfer "focus" or control to the new worksheet so the user can move around, print, do whatever on the new worksheet and then when done press "Close"
* When "Close" is pressed, delete the newly created worksheet and then return control to the original Userform.
View 3 Replies
ADVERTISEMENT
Aug 6, 2009
I am trying to do what I have quoted below. In particular,I have the two userforms set up so that I open one and then click a checkbox that opens the second userform. I would like the data I enter into a texbox in the second userform to populate a text box in the first.
Originally Posted by dominicb
Good evening scott92
Sounds like you want to dump the contents of textbox1 into a public variable and force textbox 2 to pick them up from there. You might have a problem deciding exactly when textbox2 is to update - ie what event you're going to hang it from. Are both userforms visible on the screen at the same time? is the updating to take place in real time?
HTH
DominicB
View 5 Replies
View Related
Sep 1, 2006
i have made a simple userform in which there are 3 combo boxes. a user chooses options from these boxes and then these options are put into 3 cells in a worksheet. what i need to do is create a macro or vba code so that the contents of these 3 cells are used as the Criteria for the autofilter.
View 4 Replies
View Related
Jan 16, 2008
I have userform1 with commandbutton1 and listbox1. From listbox1 you make a selection and then you click commandbutton1 and it calls up another form (userform2.) On userform2 I have a label that I need to capture the value highlighted in listbox1 form userform1. How do I write this code to have label update to the listbox selection?
View 2 Replies
View Related
Oct 12, 2006
Excel – Forms – Combo Box, cell updating.
I have a form (the main one) which accesses a second form, which accesses a third form. All forms have a combo box, control button and a text box.
The items selected in the control boxes are entered into cells (the base cells) in the spreadsheet, via “Control Source”. The text boxes access these cells and show the selected items, which are then copied to other cells via a macro on activating the control button in the main form.
The main form stays open while other items are selected and transferred. Some of the items may not be changed (reselected) as they may be common. The problem is that after a number of items have been selected and transferred, the base cells for the second and third text boxes do not update after a selection from the combo boxes, and they continue to show a previously selected item.
The problem can be solved by closing the 2nd and 3rd forms and starting again. What can I do keep the cells updating without closing the form down?
View 9 Replies
View Related
Nov 24, 2011
I am trying to use code here to facilitate "cascading" comboboxes. However, my comboboxes are in a worksheet, not a userform and I am unsure which bits of the syntax are incorrect.
Currently I am stuck at
" . . . . .
For I = nr + 1 To N
Controls("ComboBox" & I).Clear
. . . . "
The error message tells me that "Sub or Function not defined."
I think (??) the Controls function relates to User Forms, not activex and worksheets, but I don't know what to replace it with or how to alter the syntax.
View 2 Replies
View Related
Feb 27, 2013
I have built a quoting tool and Userforms to act as a user interface to this tool. The userforms basically just feed user input back to relevant sheets. I have a number of textboxes, listboxes and radio buttons on multipages. Now the issue is that each control has an Afterupdate or Change event associated with it. Consider this scenario:
I have 4 product categories (represented by radio buttons) : Cat A, Cat B, Cat C, Cat D
Each category can have up to 10 line items which are represented by combo boxes.
Now lets say the user has selected Cat A radio button, he selects a product from the combo box (the cursor or focus is still on the combo box) and clicks on Cat B radio button. Here is the issue: on the first click, Afterupdate or Change event of Combo box fires but radio button is still unselected. The user has to click Cat B radio button AGAIN to select Cat B radio button. So essentially it takes two clicks with a slight pause between them to change categories.
One way to avoid this is to press Enter or 'tab through' each field. But this is not very intuitive. I have tried using Exit, Afterupdate, Exit, Change events without success. I can't use ControlSource option because the cell to input info to is dynamically selected. I have used xlCalculationManual for some text boxes but can't use this since some inputs on the userforms depend on the right value being calculated on the sheet.
View 5 Replies
View Related
Mar 13, 2008
I have multiple dropdown lists (forms combobox, NOT activex) on a worksheet -- once the user selects them, a keypress on the downarrow will move to the next dropdown list.
is there a way of preventing this? instead, i would like to move focus to the next cell (same column, 1 row beneath the combobox)
View 9 Replies
View Related
Dec 31, 2009
I have two worksheets. On one worksheet under column G I have hundreds of random numbers, but I only want to extract a specific half. In the second worksheet I have two columns A and B. Column A has the exact numbers that I want to extract from Column G. I would like to get the numbers from Sheet 1 under column G listed under Sheet 2 Column B in reference to Column A.
View 9 Replies
View Related
Apr 11, 2008
I am trying to convert a workbook that we commonly use from worksheet functions over to VBA. Looking to use controls (buttons and such) to automate the tasks which functions used to do.
Most I figured out on my own, but there is one that is giving me some problems.
I have a worksheet page that queries data from an external database. I need to take this data and move it to another sheet with the correct formating and calculations. (see attached sample workbook. Sheet 2 is the database info and sheet 1 is where I need to move it to.)
Since the database data will have a variable number of rows, I need to do the following with a button:
1. If a row from sheet 2 contains data,
- Move the 'wonum' value from sheet 2 to the 'W/O' column on sheet 1
- Move the 'description' value from sheet 2 to the 'Name' column on sheet 1
- Move the 'wopriority' value from sheet 2 to the 'Pri' column on sheet 1
- Move the 'laborhrs' value from sheet 2 to the 'Hrs' column on sheet 1
(here is where it gets tricky)
- If values for 'targstartdate' and 'targcompdate' on sheet 2 are the same, then insert the 'laborhrs' value from sheet 2 into the correct day of the week column (minus 1) on sheet 1
(for instance if a database record's start and end date are both '4/13/2008' and the 'laborhrs' value is 3.00, then place 3.00 in the cell corresponding to the column labled '4/12/08' on sheet 1)
- If values for 'targstartdate' and 'targcompdate' on sheet 2 are not equal, then the 'laborhrs' value must be equally divided by the number of days difference and placed on the date columns on sheet 2 that correspond to all of the days (minus 1) that fall in that date range.
I filled out 2 of the rows on sheet 1 to give an example of what I am looking for.
View 14 Replies
View Related
Sep 10, 2004
I have a setup at the moment where I have a spreadsheet using a bunch of macros that are coded in a module attached to another spreadsheet. In both spreadsheets the macros are tied to Excel buttons placed within worksheets. When I copy the spreadsheets each month to new directories - they're used for some monthly reporting - I see the following behavior:
1/ The spreadsheet that contains the module with the code for the macros correctly updates the location of the macros and works OK.
2/ If I open the other spreadsheet and save it the macros appear in the tools/macro dialog as having changed location OK. However, if I try to use the macros by pressing a button the macros invoked are in the old location. If I check the assignment of the macros in this spreadsheet by right-clicking on a button, indeed the macros invoked are in the old location. This means that I have to go through and manually update for each button the macro invoked.
View 2 Replies
View Related
Aug 23, 2012
I'm working on an excel report that handles reporting for a large number of people. Another person at work is doing the VBZ coding, and I'm doing the formulas that aggregates the data. which has led to an interesting problem whenever I use a vlookup. I copied the sheets with the formulas from the test document I had been working on to an updated version. And all the vlookups automatically adjusted themselves to reference the document they had been created in. I had also moved over the tabs they were supposed to reference, but they keep looking at the old document. I spent an hour removing the references last night, but I don't want to do it again when I get the final product.
How to get excel to copy a formula EXACTLY as written, and not att in the name of the original document?
It should say
=VLOOKUP($A438,totals!$A$1:$AH$63,32,FALSE)
and instead it says
=VLOOKUP($A438,'[reporting formulas.xlsx]totals'!$A$1:$AH$63,32,FALSE)
View 2 Replies
View Related
Feb 19, 2014
I have one excel file sheet in which we enter client data and another page in the same file that formats the data. Each new row is another client.
It is a simple formula in the data formatting sheet ='data sheet'A23 for example.
The problem is when we add client data above A23, say 2 rows, the format data page will follow the original cell and now say ='data sheet'A25.
How do I keep the cell as ='data sheet'A23 no matter what I do the original page?
View 1 Replies
View Related
Jul 19, 2006
I'm trying to use the Calendar Control 10.0 object in one of my worksheets. I basically want to be able to display a value by clicking on one of the dates in the calendar. Example: Say I want the contents of cell A1 to be displayed in B1 when somebody clicks on the 17th of February 2006. Is there any way to do this?
View 5 Replies
View Related
Sep 23, 2013
I have an excel work book with 6 tabs. I would like to have Excel move an entire row from one tab to another tab (removing the row and inserting it in the other tab). I.e. Example I have a tab with items that are marked as "Open Actions" so if I were to change the drop down to close. Excel would move that entire row of actions to the tab with the "closed actions" and insert into the next available row. Now if someone were to come back at a later date say no it should be reopened than I would change the drop down to open and excel would move that row back to the open actions tab into next available row. I tried a PIVOT table and no good I played with few macro and not.
View 5 Replies
View Related
Mar 4, 2014
Is there any way in VBA to refer to a control in its own event procedure without referring to it by name/hard-coding?
It might be clearer to explain by a dummy code example:
[Code] ......
I'm seeking what I would need to replace Line1 with.
View 11 Replies
View Related
Jan 9, 2008
Within the ComboBox properties, is there anyway to control after "enter" his hit, you move to the right instead of down (similar to the edit under Tools/Options)?
View 9 Replies
View Related
Jan 12, 2007
I have created a userform within VBA which has a TreeView Control and a Spreadsheet control on it.
I have populated the TreeView control with data and what I want to be able to do is to drag the nodes off the TreeView control to the spreadsheet control.
I can drag onto a normal worksheet but not onto the spreadsheet control (the no drop mouse pointer keeps showing).
View 4 Replies
View Related
Oct 4, 2007
How do I determine which control the user is currently modifying on a multipage form (either changing, enterying or exiting the specific control). when I use "userform1.activecontrol" i get "multipage1" as the control name but I need the actual control on the specific active multipage. (also the .TABINDEX is for the multipage regardless of the on-page control) I use a generic data-field change SUBroutine so need the control name (and the TABINDEX) to provide my SELECT CASE. (so every fieldname_CHANGE calls the same SUB [with no parameters])
View 3 Replies
View Related
May 28, 2014
I have a VBA application that seems to work fine under vista but once I start working with it in Windows 7 I notice sometimes one of my userforms do not go away when asked to hide. The code is like follows:
Application.ScreenUpdating=true
Waitingform.Hide
View 1 Replies
View Related
Jun 9, 2014
I have created a userform and command button within an excel spreadsheet to run the userform and then manipulate the data entered into the userform. However when I click the cancel button of the userform the macro tries to continue to manipulate the data entered, of which there is none and then comes up with an end/debug command. Is there an If and Then statement in VBA that I can use so that if the 'Cancel button' is clicked then the rest of the Macro won't run.
View 14 Replies
View Related
Jun 29, 2007
I designed some userforms on a worksheet for users to click and input information. However, i am wondering if it is possible to have an additional feature to the userform.
Currently the userform only have labels such as Title, Dept, Branch, Unit and the respective textboxes for user to input information. As it might be unclear to some users i would like to have an additional feature such that when user roll their mouse over the label "Branch", the user will see a box where more information is given or rather an example such as "Dept XYZ", allowing user to have a clearer idea of what to fill in. Is there any way for me to add this feature?
View 10 Replies
View Related
Jan 23, 2009
I have a UserForm which has a ListBox and other TextBox, I have an issue when I select any option from the ListBox. I transfer data from the Form onto a Worksheet, which works great until I reach the ListBox.
My problem is that when I enter the information and click submit which will save the Data and send it to an Access Database. The problem arises on the ListBox. I get an error message Run-time error 3265 "Item not found in this collection"
I dont understand what the error is, how can I get around this so that all the data is written to the Worksheet and can then be transfered to the Database?
View 12 Replies
View Related
Oct 30, 2009
I was wondering if there was a way to add comments (that you see in spreadsheets) on a userform in vb editor. So that when you run the form and the user moves the mouse over a textbox then it displays the comment.
View 2 Replies
View Related
Jun 11, 2007
I have a sheet with two user forms. One which collects a few options and a second where I use a webrowser and some more options on it to do some tasks as per the options selected in number one.
I am having problems because I need to use the options that are selected on the first user form and apply them on the second userform by using if statements.
So basicaly the question is how can I use a variable defined in one userform and apply it on another userform?
View 9 Replies
View Related
Jul 10, 2007
I'm having trouble with checkboxes - I've set up the userform but I can't seem to get it to send values to the specific cells when certain options are checked.
The way it should work is there will be an action and this could be involved with 1 process or 40 processes (and anything in between) and what will happen is the userform will pop up and ask what processes the action is applicable to. The user will then tick the correct ones and the form will then place these values in the corresponding cells next to the action.
View 9 Replies
View Related
Jan 24, 2008
1) I have added multiple command buttons as options within different categories but when I select one, all others are reset. Is ther a way to section off the command buttons into groups so that say the first three act together, the next two act together and then the last four act together, allowing a total of three options within three different categories?
2) How do I get the options from the userform to the worksheet?
3) How do I put an input box on a user form?
View 9 Replies
View Related
May 7, 2008
I'm trying to hide a UserForm (using myFrm.hide) once the command button on the form is clicked. I'm getting the following error:
Run-time error '402'
Must close or hide topmost modal form first.
Apparently the form isn't the 1st in the z-order. How can I see the z-order of my forms?
View 9 Replies
View Related
Jun 24, 2008
I have had some succcess with Userforms, but I have now tried creating multipage ones.
I assumed that when I clicked on page 2 or page 3 of the multipage control, it would take me to a blank canvas, but instead it just replicates what is on Page 1. If I put textboxes and labels on page one, it repeats them on pages 2 and 3. If I delete boxes fropm page 3, they also disapear from 1 and 2!
So im unsure how to put different labels etc onto different pages.
View 9 Replies
View Related
Jul 16, 2008
I have an easy question regarding the Multipages in userforms. If I want to use Multipages, do I simply create a new userform, then select "multipages" from the controlbox and distribute all over the whole userform ?
View 9 Replies
View Related