I have created a custom submenu in Excel that uses the "SheetBeforeRightClick" event in the "ThisWorkbook" object to initialize. In the custom submenu, I want to use one of the choices to load a form that I have created. I am trying to do this directly when selecting the submenu entry, by using "MyForm.Show", but this doesn't work. As a workaround I use an intermediary subroutine, "Sub Load_MyForm" where I put the same command, and then it works! Anyone who knows how to load the form directly from the submenu click event without going through an intermediary subroutine?
I have a main form (Form1). From this main form another is loaded (form2) and then if necessary another form is loaded (form3). On form3 I have the following
I need to do a macro that will open a search window, the user would select a folder and it will search for a .csv file within it. Then after locating the file, it would automatically load it into a specific sheet in the workbook.
I have added items to my "Cell" context menu but was wondering if there is a way to move one of the items to the Filter submenu. Below is the code I am using to customize the context menuI want to move the "Filter Status" item to the filter submenu.
Sub AddToRightClick()
Dim ContextMenu As CommandBar Dim ContextMenu2 As CommandBar
'This is for the normal view right click menu Set ContextMenu = Application.CommandBars("cell")
Is there a way to have customized cell backgrounds that are more complex that Excel's preset colors and patterns?. For instance, I have a merged cell (it has to stay merged) with a value that is located at the bottom-center of the merged cell. I want to have either a fading gradient (the top of the cell is white fading to a blue bottom towards the value), or just have the bottom portion of the merged cell colored. I have Excel 2003 so I don't know if any other version has this feature.
I need to have all cells locked and protected, but I need to be able to select all cells in column A only. With 2003 I can chose to be able to select locked cells in the Protection Properties, but that allows at the same time to select all cells and I want a property to allow selection in column A only.
I have an txtBox in a userForm. I need the value of the userform in a customized format i.e. the user will be able to enter only 5 digit numbers and after the value has been entered the txtBox should dispaly the value with prefix "A".
For example: 1. If user enters values as 56, then txtBox should display as A00056. 2. If user enters values as 12346, then txtBox should display as A12346.
I have a piece of code from a form command button. its supposed to colect data and put it to appropriate cells.
VB: FoundColumn = 0
For Each c In Sheet19.Range("A5:A33").Cells If c.Value = student1.Value Then 'check if date allready exists For Each cc In Sheet19.Range("c4:nc4").Cells If Calendar1.Value = cc.Value Then
[Code] .....
I need this for Sheet19 and to 10 more worksheets like Sheet20, Sheet21 etc. I can manually copy paste the code and change the Sheet19 to whatever but it just does not seem the right thing to do. I tried:
VB: For i = 1 To 6 naming = "Sheet" & i MsgBox naming.Cells(1, 2).Value Next i
Is there a shortcut in doing this instead of copy pasting it?
I have a record just like this with about 572+ rows and 13 repeating items with that 13 items having their own column so copy pasting is really a tedious task. Kindly please help me solve this?
I'm making a task sheet for my employees and would like them to see the option in the ribbon automatically that allows you to add a picture. I have made my custom ribbon with the "picture" command right under the Home tab. I want to email my workbook as an attachment to my employees and have that picture button right there in their ribbon when they open up the attachment. Is this possible?
I have been using a scroll bar in my project to select a value from 0 - 3
Is it possible to have a customised slider (whether a form control or something created from scratch) whereby the numbers 0 1 2 3 are displayed in a grey, red, yellow and green box respectively adjacent to eachother and a slider can be moved over the top to select a value?
I would like to automate with code the process of extracting one worksheet from that workbook, and saving it as a separate workbook, with a file name equal to the text value of a cell (date formatted dd-mm-yy) from within that workbook. (ie d1="10/07/08" save file with one worksheet 10-07-08.xls)
Function MyFunction1(r, n, xrange, yrange) If r <= n Then For i = 1 To 5 MyFunction1 = MyFunction1 + xrange(i) Next Else For i = 1 To 5 MyFunction1 = MyFunction1 + xrange(i) * yrange(i) Next End If End Function
This is just a very basic idea of what I need to do, so it might not make sense why I am doing it, but I am just trying to test that the function works. Anyhow, the thing is that it works with something like this when I input it in a cell in a worksheet: =MyFunction1(RAND(),0.5,{5,6,7,8,9},{10,20,40,50,100})
However, if I try to define the range or set {5,6,7,8,9} with other cells, it does not work. so for example if I try the following:............
so i'm building an application that'll allow users to manipulate records in Excel with just a GUI, using Userforms, Modules and Class Modules. it's all working but i'm feeling like i skipped a little on structuring it properly.
for example (from my Java work in college), you'd call just one object from the main method, which would create a GUI object, and create/manipulate instances of the different Classes when buttons are pushed. basically you one object whose main created other objects, who ran procedures, etc. what i'm hoping for is to make it as modular and easy to maintain as possible. would anyone have a good resource for optimising a medium-sized application? (the tips Excel/VBA Golden Rules. These Should NOT Be Optional were very good, by the way.)
1.On Man' work sheet I Have a Project No (actual one is a big one) and project code,i have made the project code because it cannot be entered on the time sheet as the original project no is very big and i have legends,then Empl nos and OT Rates
Now on the time sheet if i enter the Project Code A to C it should be counted as "P" present for work, rest as usual.
2.On Summary' work sheet Columns D to J should calculate it automatically based on employee no or name and Project No.
I have created a spreadsheet that requires the buttons on a customised tab/ribbon in order to use it.
If this is on my machine where I have customised the ribbon it works fine. However I need to email this spreadsheet to another person - but wanted them also to have my customised ribbon. Is there anyway to do this - or would I have to go and customise their ribbon on their machine?
I'm trying to work with a user form with a customized SUM button.
What I want is that the user can select a range and then press SUM and it will sum (and store) the range and then the user can click another button to place the sum in any other cell.
Here is the code I have on the SUM button but it fails
Code:
Private Sub CommandButton1_Click() MsgBox (Application.Sum(ActiveWorkbook.ActiveSheet.Selected)) End Sub
I'm using a userform1.show vbmodeless so the user can click off the form. I tested it being able to work cross workbooks and sheets and I could see where it was returning the activeworkbook/worksheet but I don't understand the range/selected part.
I have a sheet where some data is entered in A1 to C1 and i use concatenate to string them together. The problem is in cell C1, where I used cell format to customize the number of zeros in front of the number.
EG: A1: Photos B1: 2013 C1: 00001
the concatenate result is Photos2013\1, instead of the desired result of Photos2013\0001.
I'm using the following code to create a customized userform, and it works perfectly on my computer, as I've enabled all macro settings.
Code: Function GetOption(OpArray, Default, Title) Dim TempForm 'As VBComponent Dim NewCheckBox As MSForms.CheckBox Dim NewLabel As MSForms.Label Dim NewCommandButton1 As MSForms.CommandButton
[Code] .......
However when my coworkers need to use the code it creates an error, as the VBA project is unsafe.
Now my question is, can you write some code that enables all macro settings temporarily, in such a way that my coworkers can use this code?
My company uses a customized accumulative code week system, as in the year 2000 to today is about 442 weeks with the year 2008 starting around week 416.
Here is how my formula works(or how I would like it to work), if the date (in cell F8) is blank, nothing is displayed, if there is a date (format 2008-07-03) and it falls within 2008, WEEKNUM+416(416 is a fixed reference in J4), if the date falls within 2009, WEEKNUM+416(J4)+52, if the date falls within 2010, WEEKNUM+416(J4)+104. I only need it to go from 2008 to 2010.
This way J4 is a fixed code week reference where 416 is added to each week number, but it does not work for years 2009 and 2010 as it does not add the weeks from the starting reference.
I have a spreadsheet that I have a lot of macros that are attached to a customized toolbar saved in the same spreadsheet. I saved this is a read-only file. When I open as read-only and run my macros (testing), I save it as another file. When I then open the "template" to do the same thing, the toolbar/buttons now reference the file I previously saved as something else. Help please? Is there a macro that would delete all macros before saving the file as something else?
I'm missing something in my UserForm initialization code. If I fill the form out once and click 'OK' (run the code to put the form data into a sheet), when I go back into the form all the old info is still there. If I then click 'Cancel' (Unload Me) and reopen the form, the old data is cleared out. What am I missing to make it clear it out the first time?
I'm having trouble trying to come up with a way to insert data fields into a spreadsheet form. I have a travel authorization form that I would like to have automatically fill in the required fields based on typing in a name. i.e. I would type in an employees name, and it would automatically fill-in the correct address, etc for that employee. I have attached a spreadsheet that contains one sheet as the form, and another sheet containing the employee data. I know nothing about VBA, but I have a feeling that is where I need to go.
I am needing to create a form that exports data (a quote) to an Excel Db (table) and is then able to recall the data back into the form. (the default form in excel does this and I want to copy that.)
Once the data is called back in, I can then export it to another Table to show that the quote has been approved and will be used.
I am having trouble with the VBA coding that copies the inputted quote in Cell C2 (the reference for the quote number) of the "Form" sheet and looks it up in the "Database" sheet. I have tried several variations of code, but nothing works so far.
-SS Sub RecallQuote() ' ' RecallQuote Macro ' Sheets("Form").Select Range("C2").Select 'this is the cell that holds the quote number to look up from the table
I have a spreadsheet I use to keep track of weekly sales patterns and use for estimating the amount of a product I would need to order taking into account what I would expect to sell in a given week and what stock I have at present. On the example I've attached, I show where I enter my storeroom count figures, which are organised by supplier and the position in which a particular product appears on the supplier's order form. I have a page which lists the orders by suppliers and which are used to place the orders by e-mail or telephone.
At present I have each supplier section of the order form directly linked to a cell on the storeroom count as per columns K to M on the attached file. However, this means that as products are de-listed by suppliers and extra products become available, I have to edit the formula in each cell as the products now appear in a different position on the storeroom count and may otherwise end up on the order form for a different supplier. I would like to set it up so that I just have to select the supplier name and the table below will automatically fill with the required info, in order of the position they appear on the supplier's form. I'm struggling to combine vlookup and hlookup. Is there a way to do it or do I need to rethink?
I'm trying to pull up a second form from a command button within a form. There's a command button in a sheet to open the first form (frmOrderInput.) Then there's another command button in that form to open the second form (frmPriceInput.)
I have got a userform that fits my 24inch monitor screen perfectly, however it doesn't fit other screens. How do I get windows style scrollbars added to the form so people can use these to see the whole form?
I have a Database and user form, in the user form i have a field named “Vehicle No” this is a combo box from which a user needs to select the Vehicle numbers, and all these are working fine now, I need your help in the following:
When user selects the second field named "Select Vendor name" i need a pop up window which shows all the Vehicles belongs to the vendor which they have selected, and with the popup window user selects the vehicle number then the Vehicle number combo box should be filled.
Currently users have to select by scrolling through Combo box which takes long time and difficult to find by scrolling.
I have this piece of code that loads a list box and it has worked without 1 problem for the longest time.
Today, there have been 4 or 5 instances when it doesn't work, where I hit the load button and it does nothing.
I have closed down and restarted and it seems to work but this is very annoying
If txtBusinessName = "" Then MsgBox "Please enter search criteria" Exit Sub End If lbxRecords.Clear Application.ScreenUpdating = False shData.Activate.......................................