but now i want that when this new sheet will open there will be some labels, textboxes and buttons n etc will be appear on that sheet so how can i display these elements on new sheet dynamically ??
Basically, I am taking user input to determine how many textboxes to create during runtime, and want to call the contents of those textboxes after the user has put something in them.
Code to create buttons on a userform. I have adapted his code to do what I want. The code he gave me was:
[Code]....
In the Class Modules:
[Code] ........
All buttons when created are coloured yellow. When a button is clicked, it turns blue (to indicate that the button was clicked. However, my problem is that when another button is clicked, it also turns blue as coded. This means that both are showing blue colour. I want all other buttons to turn yellow and only the button clicked should turn blue.
I have 3 text boxes. and a numpad of 9 command buttons.
I wish to click on one text box and then click each of the "numpad" command buttons to populate the actve textbox with the number buttons that i click. What VBA code would i use to do this?
I think i can code something like this quite easily, the bit i am struggling with is how to make it so that only the active textbox text is amended.
I was re-reading Chnadoo's thread below on using a hyper link to drive a formula, and was wondering if there was a way to do the same thing with shapes. Interactive Dashboard in Excel using Hyperlinks | Chandoo.org - Learn Microsoft Excel Online I tried doing it where I used a hyper link on each shape to link to a cell containing a number, that in turn would be picked up by the cell that I would want to be incororated in to an INDEX function.
Let's say cells A2 to D2 contain the numbers 1 to 4. Cells B3 to D3 have an oval shape which are each linked to the cell above it by a hyperlink.
Upon selecition of any of the shapes I was trying to get the corresponding number to appear in cell P1 by way of very basic VBA. I was trying to get it to pick up the number by way of referring to the ActiveCell, but cell P1 wouldn't update automatically upon each selection of a new shape.
I know there are other ways to get what I want with scroll bars, spin buttons etc but I'm interested to know if it can be done with shapes.
I have a userform that has one combobox at the top created manually. When the userform is opened, the user select an option in the combobox (these options are taken from a range on 1 worksheet). From the selection of the combobox, I use the comboxbox's change event to create and display 5 columns of textboxes and 2 columns of command buttons on the userform.
The number of rows of textboxes created depend on the option selected from the combobox since each option links to a different range of cells. Each of the 5 textboxes in each are set to be ".enabled = False" and display text as per the cell values within a range on another worksheet. 2 Columns of command buttons are created at the end of each row of textboxes - 1 is enabled and the other is not.
The creation of the textboxes and command buttons works as required. However, I am having problems with setting click events for each command buttons. When the 1st column of Command buttons are created, I need the click events to be created and filled out with 2 actions:
1. Enable all textboxes in the same row as the command button
2. Enable the other command button in the same row.
Here is the code I have so far that creates the textboxes and command buttons.
Each of the 5 textboxes and 2 command buttons have a unique name so the 1st row will have textbox and command button names of cTxtA1, cTxtB1, cTxtC1, cTxtD1, cTxtE1, CmdAmend1 and CmdConfirm1. The 2nd row will have the same names but with 2 on the end and so on. The bold sections is the code for the creation of the command buttons that I want click events for.
Code:
Private Sub CboTeamSelect_Change() Application.ScreenUpdating = False If CboGroupSelect.Value = "" Then Exit Sub Dim cTxtA As Control, cTxtB As Control, cTxtC As Control, cTxtD As Control, cTxtE As Control Dim CmdAmend As Control, CmdConfirm As Control Dim iNum As Integer Dim TxtTop As Long
how to get some command buttons to stick in one place? I currently have two in a summary sheet. Each button runs a similar code which clears and deletes (by shifting cells upward) at the start of the process, then populates data.
It's rather annoying though that I cant have the buttons stick to one zone, they end up moving left or right depending on which button I press. Each report also changes column sizes, dont know if that's relevant?
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 a formula in the first worksheet called 'Summary' of my workbook. This formula calculates average of the data in other worksheet. How do I change the worksheet name in the formula dynamically?
e.g. The second worksheet is January. The formula in cell A1 of worksheet 'Summary' calculates the average of the data in the range A1...A12 of worksheet 'January'. When I copy this formula to cell A2 in worksheet 'Summary', the worksheet name in formula remains 'January' and it does not change to 'February'.
One more important thing is that the worksheets are being added automatically i.e I can not define all the worksheet at first go.
I am using a ComboBox on a worksheet where the items in that box are pulled from Sheet1A:A. When the selection of the item in the comboBox is made, I would like several textboxes on that same page to be auto-populated based upon info derived from cells adjoining whatever row in Column A was chosen on Sheet 1.
For simplicity sake, let's say the range on Sheet 1 is A:H, and TextBox1 = "B", TextBox2= "C", etc.
so if, A B C D JOHN 15 DOGS BLUE SUE 18 CATS RED BOB 20 TURTLES YELLOW
When Combobox selection is JOHN, I want TextBox1= "15" TextBox2= "DOGS" TextBox3= "BLUE"
I have about 50 tabs one for each city and i need to update information everyday for each of those cities. I now what the macro to update all the new entries in each of the worksheets into a consolidated Summary sheet. This is dynamic so if 10 rows are filled in the summary tab and if i update the rows in the individual city worksheets the summary tab should paste values from the 11th row and so on
When I enter values in the userform textbox and press update button i need to copy whole row of data which is next to the textbox from userform to database sheet. (Copy only if data entered in the textbox).
Basically if textbox has a value in userform row 1 and it has a value copy it to database sheet if not skip and if value is in other texbox copy other rows.
I have numerous Text Boxes on my worksheet. The number of these objects vary, as many will be continually duplicated/ deleted.
The code below is a simple recording of selecting each object and scaling.
VB: AutoLinked keywords will cause extra spaces before keywords. Extra spacing is NOT transferred when copy/pasting, but IS if the keyword uses "quotes" ...
I'm trying to copy a worksheet and place it at the end. I will rename it afterwards. I'm using the following code but it doesn't work.
Private Sub Copy_sheet() Dim wbk As Workbook Dim wsh As Worksheet Set wbk = ActiveWorkbook wbk.Worksheets("Template").copy After:=wbk.Worksheets(wbk.Worksheets.Count) Set wsh = wbk.Worksheets(wbk.Worksheets.Count) wsh.Name = "New Sheet" End Sub
I am trying to create a basic order history in excel from orders generated on our limited ERP system. I have exported the data required and imported to excel, but due to the export limitations, I can only export certain fields at a time. This means that I have to create three sheets for all the data I require.
The first sheet has the bulk of the data and is now nicely collumned. However, I cannot get both the customer code and full customer name on the same sheet due to the aforementioned limitations. Sheet 1 has customer code and other data, sheet 2 has customer code plus full customer name.
I have created a collumn for the customer name on sheet 1 (A3) next to the customer code (A2)
Basically, what I am trying to get it to do is as follows: In "A3" I need to create a formula that states that if A2 contains a certain customer code, then look in sheet 2, match the code and place the full customer name for that code. Bearing in mind that we have over 395 customer codes in use, so asking for a specific code to lookup would be as time consuming as entering the codes manually.
In Column A, anytime a specific "text" appears, I want to concatenate the information in the row, and place it into worksheet Data-list under a specific heading.
[URL]
The formula I would use (not vba) is =IF(A3="FN",B3,""), then I just copy it all the way down. However there are 27K cells, which is why I want a VBA Code
now I thought about recording the macro, but it's an offset and if you click the chart, then it'll mvoe somewhere else even though the charts are always placed in the middle when generated. So I think I need to place it in a specific range. I want to use XY coordinates or range labels or something to that effect but would like something to this affect:
With Charts.Add .ChartWizard source:=Worksheets("sheet1").Range("a1:a20"), _ gallery:=xlLine, title:="February Data" End With
I got that in VBA help, but I'm not using Chart wizard, my code just creates the chart from the data on its own with specific chart type. So anyway, how would I make it put each of my five charts for the 25 people in the same place for every person. Performance Errors etc etc etc all will go in the right place everytime, regardless if you start with the page scrolled. I should do range right, but how do I change this macro to do it without chart wizard...just a chart that's already created and named. QUESTION: How do I place charts that are created from a data source onto a specific area of one worksheet, and those charts are always in the same place regardless of the person'a name.
I have two workbooks, one a database that accumulates data over time, and the other a monthly report that needs to be populated based on information from the database. When moving data between the two, the following works fine (snipped a lot for ease of reading):
As you can see, it simply puts the month from a cell in the database into the report workbook. However, if I change Range("A1") to Cells(1,1) I get a runtime error:
I can generally work around this issue by changing the active workbook, but doing so is a big pain. Is there any way to use the second bit of code without popping an error message?
I need to copy/cut and paste an Html table from a website into and Excel sheet without the data being transposed. See link for the table I need to get into Excel:
I have a work book with prob close to a thousand individual work sheets in it. I have a goup of cells that are the same in ever work sheet that I would like to pull and place into a master work sheet. I dont want to copy and paste each one, I'd be a hundred before I finished and I dont have that kind of time. Im thinking a macro might be what I need but Im not very good with useing them let alone making one to fit me needs.
I want to enter a value in a textbox, search for it in an worksheet, and populate other textboxes with adjacent values if the value is found. Anyway, the problem is that if the value is not found, I get a debug error.
I'm sure there's far better code to do what I need, but I tried to keep it simple. With the above code, it only works if the value is found. If it's not, I get an error. So how do I make it so that if the value is not found, the value of the textbox2 is "Not Found" or something...
Script that lists the caption names of all work sheet commandbar buttons, one script to list them on a worksheet and another to list them in a listbox.
I have buttons (macros) on top of my worksheets. The sheet might contain more than 1000 rows.
Now, what I want is that the buttons should remain constant on top (floating) horizontally and vertically even when the sheet is scrolled down or right etc.
An example would be Windows | Freeze Panes. But I need an alternative.
I am creating scorecards for our company and ratings are inputted using radio buttons (form control). I have a "clear" macro that clears all fields and radio button values (none is ticket). This macro is called throughout different sheets, as different roles in the company have different KPIs and should be on different sheets. I need a code that detects all radio buttons within a certain sheet and clear their values. I cannot put specific radio button names, as I have a lot.
I have a worksheet that I need to copy and paste to > 50 different sheets in the same workbook. It contains 2 textboxes and 2 buttons - is there a way to do that with VBA?
I'm trying to create a macro that creates new worksheets with buttons on them that have macros attached. I've been able to produce one worksheet with a button and macro, but when the function that copies the code is looped it crashes out of Excel.
I realise that the usual method of doing this would be by templates, but this code will be run on other people's computers so the template wouldn’t exist in the location that i had specified (I think with my limited experience with VBA - Please correct me if I'm wrong). I've also tried to copy the page with the button on, but this takes too long (even with screenupdating = false) as there are many sheets to be created.
This is a stripped down version of the code that I have created for the purpose of this forum. To recap, the function that creates a new page, with button, with macro attached works. It's when it's looped that it crashes out. I've stepped through the program, and it reaches the second message box, then it gives up on life ..........
I am trying to use a For Next loop to loop through several option buttons on a worksheet in order to set the value of each to false. I cannot seem to get the code right.