Custom Button With 2 Sorting Functions
Mar 21, 2007
I am trying to create a custom button in Excel that will sort on two different columns. One column has $ Sales and the other has Unit Sales. So you can click on the button and it will sort by $ Sales and if you click the same button again it would sort by the unit sales. I'd also like the text on the button to reflect what option the data would be currently sorted by. I am able to do one of these macros and assign it to the button, but can't figure out how to get both sort options assigned to the same button. I have had outside people send spreadsheets to me with this but can't figure out how they did it.
View 2 Replies
ADVERTISEMENT
Sep 2, 2008
I want to be able to create a range of VBA userforms to quickly perform long tedious tasks. I want these userforms to be accessed from a nice tidy toolbar.
I have done this and it looks nice and works well. What I would like to be able to do is have my custom toolbar of userform controlled functions be transferable so that if someone else wants my toolbar and attached functions they can install it easily much the same way you can do with an add in.
Is this sort of thing possible or does it require them to manually install all my userforms, modules and toolbar? If it is possible what sort of things should I be looking at?
View 9 Replies
View Related
Dec 3, 2008
I am writing some custom functions to be saved in an Add-In file, but am having trouble saving named ranges. I would like named ranges in the Add-In file to be available in other spreadsheets. Is there a way to do this? Or is there a way to take a range from Excel and save it into a globally available named range using VBA?
View 9 Replies
View Related
Nov 28, 2006
I have created some user defined functions and have associated them to a custom category. To simplify things, I wanted to add these functions and the custom category macro to an Addin I already have installed for all my employees. How do I get the the custom category macro to excecute? It should run as soon as excel is opened...but I am not sure what event should be used and where is it installed?
View 2 Replies
View Related
Dec 5, 2008
I am trying to create a custom function to act much like the database capabilities of excel in summing a column based upon multiple criteria of other columns. First, before I get too far, does anyone have an already built custom VBA function that will accomplish this? I find that using the built-in database functionality in excel is VERY slow!
Anyways, I am trying to pass an argument that contains multiple ranges (much like you can do with the SUM() function):
=MultipleSUMIF("E11:E14, F11:F15", "A1, E1", G11:G14)
The first set of arguments is the ranges that I need to look through. The second set of arguments is the values that I need to search within the first two ranges. The third argument is the column that I need to perform a SUM function on.
Instead of doing this, how can I create a function that will allow me to say, "Add another criteria range/value" and it will add another criteria to the list. I am currently passing a string, and that is not ideal, obviously.
View 9 Replies
View Related
Aug 20, 2008
Recently I found this forum through a Google search along with the perfect solution to a problem I was having finding and replacing text based on a table of replacement values. Here is the thread:
Multiple substitute or replace text using a table
I incorporated the SuperSub function that steveorg developed as a result of that thread into my worksheet by creating a new module and pasting the following code into it:
Function SuperSub(OriginalText As String, rngOldText As Range)
Dim cel As Range
Dim strOldText As String, strNewText As String
' loop through list of old_text used in substitute
For Each cel In rngOldText.Cells
strOldText = cel.Value
strNewText = cel.Offset(0, 1).Value
OriginalText = Application.WorksheetFunction.Substitute(OriginalText, strOldText, strNewText)
Next cel
SuperSub = OriginalText
End Function
It works like a charm as a formula, but I also have a macro in the same workbook that, as soon as it selects the sheet with the formula, calls the SuperSub function and starts executing the code as a macro (even though there is no call to this routine in the macro). The macro ran just fine before incorporating the function into my worksheet.
The formula looks like this: =TRIM((supersub( UPPER(E2),rngSubst)))
If cell E2 contains the string "101 North Main Street, Apartment 5", it would return "101 N MAIN ST APT 5"
Here is the macro:
Sub Import()
'
Sheets("Shoebuy FTP").Select
Range("A2:R200").ClearContents 'This is where it jumps to Function SuperSub(OriginalText As String, rngOldText As Range)
The function runs for every occurrence of the formula in the worksheet, and when it is finished, all of the cells containing that formula show a value of "#VALUE!". I should mention that it does not change the formula at all, but I then have to highlight each cell that contains the formula, press <F2> to edit, then <ENTER> to get it to display the correct results again.
It is probably some stupid little thing that I didn't do when I created the function, but I can't figure it out. I have written numerous macros, but this is the first time I have ever created a custom function.
View 5 Replies
View Related
Jul 31, 2014
I have this excel file with some functions inside a Pivot Table, which use a year value as filter (the value comes from a report filter field) and data from a different spreadsheet to calculate a percentile value ... I created custom functions to replace the excel functions, passing the values as parameters.. The problem is now that when we refresh the connection (Refresh All button under DATA tab) the cells that contain the values returned by the custom function lose those values (go blank) In order to get the values I need to select the filter value again, while when I was using the normal PERCENTILE function the values would always refresh normally
Now... I think the problem might be related to the fact that the spreadsheet in question calls 5 different custom functions at the same time.... and, those 5 function call another at least two more helper functions... so, maybe this recurrence in calling the functions is causing the thing to break up
Is there a way I can prevent this from happening? Maybe put some flag or something that will cause the functions to be executed one by one, and not all at the same time?
View 2 Replies
View Related
Jan 11, 2010
I have a spread sheet that contains many user defined functions from a 3rd party provider that downloads financial data from an external database. Often not all of the data is required by the user, and as the UDF's take a long time to calcuate, i'd like to provide the ability to easily switch them on and off. Originally I had been looping through cells and either adding an apostrophe in front of the = or removing it. However running this loop is very slow.
I found this thread
(Optimize VBA Loop For Inserting Formula)
and adapted it to convert formula strings (with ' in front) to formulas in a single pass by setting:
myRange.formula = myRange.value. This works very well. I can't, however, work out how to go back the other way in a single pass. Have tried: myRange.formula = "'" & myRange.formula. This works for individual cells, but not for more than one at a time.
View 3 Replies
View Related
Sep 30, 2006
Assume I have a sheet consisting of 50 rows with 3 columns of figures. A fourth column contains a formula to calculate values, eg A1+B1+C1, on each line/row. I could enter A1+B1+C1 in the first cell and Copy, Paste to the other 49 cells. Alternatively, I replace A1+B1+C1 with a UDF.
Is there any difference in performance with using a UDF compared to using the long-hand/standard approach, or is it just a question of convenience? After all, both are doing the same operation with the same calculation.
View 5 Replies
View Related
Aug 6, 2014
I've got a few worksheets that have staff names on Col A. And these names are under sub headings of what position they work in (Foremen, Operatives etc..).
Before I had access to them, the names were not in order, now I've change it to A-Z, for each staff under their position.
I know you can make your own custom order list, so the list goes top to bottom : Supervisor, Formen, Operative, Office.
What I sometimes need to do is sort Col B or C. But is am unable to sort it back to it's original state
Attached is an example of how I would like my spreadsheets to look. But is there a way to use Sort & Filter so it sorts the entire table by position, keeping the correct name under the correct position heading.
New Microsoft Excel Worksheet (2).xlsx‎
View 9 Replies
View Related
Jan 11, 2010
I am trying to create a custom sorting in VB. My sorting needs to be first on column B, then C and last on G. My data does not have headers.
View 5 Replies
View Related
Jun 20, 2013
In Column A there are randomly assigned numbers using the RANDBETWEEN function.
In Column B there are three possible values X, Y, and Z.
I want to create a sort order where "X" is always at the top but then the rest of the rows are randomly sorted by column A (Y and Z values are intermixed).
Currently I tried to use a Custom List and the value is "X" to sort first, and then a seconday sort of Column A. The problem is that column B is always sorted by X then Y then Z where I am trying to get the Y and Z values to be randomly intermixed based on the sort of the random numbers in Column A.
I know I can manually do 2 seperate sorts each time, but I would like to save a sort list to the file so I recreate that sort over and over again.
View 3 Replies
View Related
Jun 20, 2013
I want to sort all of the "column2" by alphabetical order. The order will be first by state and then by city. For example the first box the column2 order should be (Fountain Hills, AZ) properties first followed by (Mesa, AZ) properties second followed by (Peoria, AZ) etc.... ending with (Flower Mound, TX) last.
The issue that I'm having is that when I create a custom sort the comma after the city indicates a new value being AZ. For example my custom sorting looks like this: Fountain Hills, AZ, Mesa, AZ, Peoria, AZ. This is limiting my ability to sort the files as is with city, state. I solved this issue by removing the commas after all the cities. This worked but was time consuming. Is there a faster way? The workbook is below.
Development Projects Mr Excel.xlsx
View 2 Replies
View Related
Jul 17, 2009
I need to custom sort a column. I have 3 different types of data in the column. First - multiple dates, Second - "TBA", and Third - "ASAP". What I need is when the column is sorted the "ASAP" rows will be first, the dates (sorted) will be next and finally the "TBA"s. I have been trying to use a custom list.
View 2 Replies
View Related
Jan 17, 2008
I need to sort numbers in a specific ascending way in excel but I'm not sure how to create a filter, number format or custom sort which will do it.
Sample Data:
245.1
245.10
245.11
245.12
245.2
245.3
245.4
245.13
245.14
245.15
245.19
.................
Sort Result:
245.1
245.10
245.11
245.12
245.13
245.14
245.15
245.16
245.17
245.18
245.19
245.2
245.3
245.4
245.5
245.6
245.7
245.8
245.9
Expected Sort result:
245.1
245.2
245.3
245.4
245.5
245.6
245.7
245.8
245.9
245.10
245.11
245.12
245.13
245.14
245.15
245.16
245.17
245.18
245.19
View 9 Replies
View Related
Feb 11, 2010
I have a column ("R") which contains prices. What I'm looking to do is have a form control button that either hides that column, or better still just turn the font white (invisible)on the press of the button, then with another press turn the font back to black (visible) or do I require 2 buttons to carry out this function. I don't wish to have the column formatted in anyway after the changes, simply 1 press turns the font white and either another press (or another button) turns the column back to the exact same state (no formulas present) as it was.
View 10 Replies
View Related
Feb 13, 2013
I have this request excel sheet which needs a button to do multi functions:
First the sheet is placed in remote server and had two working sheets (say sheet 1 and sheet two), in sheet one there are fields must be filled by the user and a sequence number must be issued for each request.
1- when the button clicked the request serial number must be added by one (counter).
2- log the new serial number, user name and datetime in sheet 2.
3-save the sheet on local pc
4- disable the button after click so that the user could not click the button twice for one request.
View 1 Replies
View Related
Jan 28, 2014
Problem we are having with sorting a table.
The table (A1:E10) was created by pulling data from another worksheet using INDEX and ARRAY formulas.
We inserted 6 columns to move the table over to G1:K10 (used column F to space the two tables).
We then duplicated the table: cell A1=G1, B1=H1, ...., E1=K1 and dragged the formulas down. We now have a duplicate table that we want to sort.
We choose CUSTOM SORT and choose 2 levels of sorting ... column A and column C.
PROBLEM: The ARRAY formulation evidently overrides the sort function because the table remains as it was when the sorting command is executed.
Is there a way to bring the data from table G1:K10 over to table A1:E10 in a manner that will allow sorting??
View 9 Replies
View Related
Aug 8, 2013
I have a pretty developed add-in I've created for use at work. It has 3 full custom ribbon tabs worth of buttons and boxes and other features that run all of the macros in the project. Everyone loves it. The only problem is, its only used when we work with customer statement excel files. When using Excel for other tasks it is annoying to have 3 extra, essentially useless tabs taking up space on the ribbon.
Is it possible to create a button and stick it on, say the Data tab, that will "Start" the add-in and make the 3 custom tabs visible? Ideally there would also be a button to "Close" the add-in or hide the extra tabs until they're needed as well, but how to customize for my specific needs.
View 1 Replies
View Related
Aug 14, 2007
Is there a way to insert a toggle button into a custom tool bar?
View 4 Replies
View Related
Apr 16, 2006
Finally after 3 days of intensive studying VBA, my first add-in pack is ready to be installed in the office. I've got my custom form all ready, now all I need is to have excel create a custom button on the toolbar that calls up my custom form when clicked.
The idea of assigning a shortcut key doesn't really appeal to me. I'll be packaging it up in .xla format. Would be greatful if anyone can direct me on how to add a button to call up my form (only one form in fact).
View 2 Replies
View Related
May 13, 2006
I have a spreadsheet with a large number of sheets in it and was trying to create a easy and intuitive way to navigate. My solution was to create a tool bar and populate it with buttons. Two Issues:
1) The attached code (ButtonName) works well except if the “Begin a Group” flag is set on a button, the index seems to be one off per flag.
2) How do you set the “Begin a Group” flag from VBA?
Sub CreateNavBar()
Set newBar = CommandBars.Add( Name:="CostBook Navigation")
newBar.Visible = True
For Each mySht In Worksheets
Set con = newBar.Controls.Add(Type:=msoControlButton, ID:=2950)
con.Caption = mySht.Name
con.Style = msoButtonCaption
con.OnAction = "ButtonName"
Next
End Sub
Sub ButtonName()
SheetToActivate = CommandBars("CostBook Navigation").Controls(Application.Caller(1)).Caption
Worksheets(SheetToActivate).Activate
End Sub
View 2 Replies
View Related
Aug 10, 2006
I need to select a print area that includes all rows to the last row with data in column A. What is the proper code for this? I tried the following (shot in the dark), and of course it doesn't work.
Sub Print_()
ActiveSheet.PageSetup.PrintArea = "A( Cell((65536).End(xlUp)):X1"
ActiveSheet.PrintOut
End Sub
View 9 Replies
View Related
Apr 3, 2007
how to change the name of a Command Button that I have called "Command Button" on the Tools menu.
Also if I have this button created in my Personal workbook and I send the file to another user what should I do? Will that user be able to see this button ok?
View 4 Replies
View Related
Jun 23, 2005
I am using the following code to create an Excel toolbar custom control Button. What would be the VBA code to change the color of the image I have chosen? ....
View 6 Replies
View Related
Sep 20, 2006
I created a custom toolbar button which works perfectly.
Because I needed to save each workbook as a specific workbook this is taken care of by the vb code.
I would like when the button is pressed for the original workbook template to be opened.
At this moment if I have a blank workbook or no workbook open and I press the button the programme opens a version of the workbook but not the template version how do I point Excel at the templates.
View 3 Replies
View Related
Jul 22, 2014
Here I have a listbox, but I would like to know if it's possible to be able to sort each header on the userform when clicking on the header?
Also, how should I also delete some entries with a button?
listbox.xlsm
View 14 Replies
View Related
Jun 20, 2013
I already have a Macro button built that hides values in column A. The next step I am trying to perform is a custom sort on column B in this order "Backordered", "Sourced", Shipped", and "Received". Here is my code that I have so far but where to begin adding in code to make this button sort.
Sub Inbound()
ActiveSheet.Cells.EntireColumn.Hidden = False
ActiveSheet.Cells.EntireRow.Hidden = False
Application.ScreenUpdating = False
[Code] ........
Excel 2007/Windows 7
View 1 Replies
View Related
Aug 12, 2006
Image size appears in button(msocontrolbutton) of custom toolbar Excel 2000 is very small and blurred using below code. How I can increase size of image in button (msocontrolbutton) as well as brightness of image in custom toolbar? I am able to increase size of button using width and height property but image appears in center of button as 16X16. How to fit image to button(msocontrolbutton)?
Const cImgCommandBarID As String = "TMC Img Toolbar"
'Image code
Dim cbImgBar As CommandBar
Set cbImgBar = CommandBars.Add( Name:=cImgCommandBarID, Position:=msoBarTop)
'cbImgBar.context = 1000
Dim cbImage As CommandBarControl
Dim imgTool As Shape
Dim sFileName, ImgSheet
sFileName = ActiveWorkbook.Path & "ImagesABC.jpg".....................
View 2 Replies
View Related
Mar 25, 2014
I have a problem on auto-sorting my data after clicking the "x" or "Close" button on DataForm. Im creating a command button that trigger a macro to open an autofill DataForm. I want a code that everytime i ADD or EDIT using the DataForm, it will automatically sort the Column A after clicking the "x" or "Close" button. Below is the code of my macro:
Code:
Sub OpenForm()
Sheets("DATA").Select
ActiveSheet.ShowDataForm
End Sub
View 1 Replies
View Related