Excel 2010 :: How To Assign RELATIVE Macros To Custom Ribbon
Aug 19, 2014
I currently have an excel workbook (2010) in which I created a custom ribbon and assigned several different macros to the buttons.
Long story short, I will be saving several variations of this workbook every so often when I get new data.
The problem is that if I change the name of the file (Save as or Rename), the custom ribbon buttons no longer work. When I assigned the macros to the ribbon buttons, the macros were absolutely assigned.
Is it possible to assign relative macros to custom ribbons?
From research I have done, it appears that custom ribbons cannot be created using VBA. Is this still true?
I have an excel tool I am adapting to 2010 from 2003. It imports another tool which has been created elsewhere in my company and it is protected so I cannot alter it. This tool that I cannot change creates its own custom toolbar the "old fashioned" way so it dumps into the add-in tab on the ribbon. My tool opens this corporate tool and changes some items on the toolbar (enters values in a text box) and then imports data from it. However in run-time the custom toolbar never appears. Is there a way to refresh the ribbon in run-time after opening the file so I can then access the toolbar items?
I need to insert a picture on a Excel 2010 worksheet.
The worksheet contains a variable number of columns, and the column width is also variable.
The picture needs to be aligned such that the right edge of the picture is in line with the right side of the last used column.
This is so that when the worksheet is converted to a PDF document the picture (company logo) appears on the top right hand side of the page.
I can find the cell reference for the last column, and I can move the picture around the page. But I'm not sure how to find the position of the last column on the page?
I've got this far:
'copy picture and resize and position Sheets("Output File").Select ActiveSheet.Shapes.Range(Array("Picture 1")).Select Sheets("External data sheet").Select Cells(1, 10).Select ' I can make this be relative to the last column on the WS ActiveSheet.Paste Selection.ShapeRange.Height = 50 Selection.ShapeRange.IncrementLeft 0 'put the picture in a position relative to the cell selected
did in [URL] but my issue is complicated by not knowing what cell I need to move the graph to.
I am using Excel 2010 and I am a realitive novice at writing VBA code.
In My spreadsheet, I have a list of properties and some related cost info. From week to week, the number of properties varies. Some days I will have 6 properties and others I could have 100. Because of this, I need to make all of my references relative to other cells. I am having trouble repositioning the graphs that I have created from the data to be 2 cells below the label I have created for the graph (which is a merged cell covering Columns B:I on a row 3 rows below the last property in the report.
So far, I have:
Dim r1 As Range, r2 As Range, GraphRange As Range Cells(2, 1).Select Selection.End(xlDown).Select
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.
I have a validation drop down menu with the 12 months in it on Sheet 1. User picks the current month from the drop down list. I have 12 macros in the workbook, one for each month. Based on what month the user selects from the drop down, I would like to run a specific macro. The macro hides specific columns on sheet 2 of the workbook.
for example...user picks May from drop down which triggers macro MAY to run. If user picks Jun next month, macro JUN will run.
Created a new tab and menu buttons on the Ribbon in Excel in 3 separate .xltm files. Everything worked great through all of the development and testing, but when we went live we got reports of a bug. Here is what is happening...
User opens the template file and immediately saves it as a .xlsm file with a new name in a new location. The user then does various amounts of work in the file. When the user needs to use one of the tools on the custom tab, it is as if the buttons are inactive or not associated with any actions. The tab and buttons are all visible, the animation of the button being pressed works when any of the buttons are clicked, but nothing happens. The user can close and reopen the file and the ribbon buttons will work correctly, but not until they close and reopen.
Upon digging into the problem, we found that if the user clicks on the custom tab before they save the file, all of the buttons will work correctly after the save. But if the tab is not activated before the save, they dont work until a close and reopen.
The XML code is good because if I place it in a add on file (.xlam) and trigger it from the main file, there is no problem. But this is not a good solution since the add on file needs to be located in the same file that the main file is run from which can be any number of places.
In cell 'I6' if I enter the text "Balance" I would like it to display as "Actual" but if any other text is entered I would like it to display the text entered. How to do this using custom cell formatting. (Currently on Excel 2010).
I'm trying to get Excel 2010 to automatically generate a custom timeline in a separate tab using data I enter in a different tab. In the attached example, the data in the first tab ("daily log") tracks the number of trucks parked at a certain yard by the state they are registered in, their company, and their ID number. I would like Excel to automatically generate the timeline I've created by hand in the second tab ("Timeline (desired outcome)"). I need a formula that returns a "1" if several conditions are met (see comments in example) and a " " if those conditions are not met. I played around with IF(AND...) functions, but I've never used them before and couldn't make them work. There are a few complicating factors: there aren't a consistent number of trucks at the yard per day, and some trucks changed their ID numbers during the data period. I use a blank row, highlighted in dark grey, to visually differentiate days. This row can be filtered out with the "null" column.
I noticed that my custom "Close without Saving" button stopped working. I checked the VBA editor and my Personal workbook was missing and all of my personal macros were gone. I restarted excel, same issue. Rebooted my machine and they re-appeared. Not sure how what happened, but at least the Personal workbook was not lost. I'm working off my company's network, so often I get the "Personal Workbook is locked for editing" message. I usually select the open as read-only file and go about my merry way. Perhaps I clicked something different on accident without paying attention.
Anyway, I digress, the custom macro button that I had in my ribbon still didn't work, so I removed it and tried again in both the ribbon and the quick access toolbar with no success. The Macro executes if I execute it manually or via the keyboard shortcut, but the ribbon/quick access toolbar buttons won't work. Frustrating, because I use this quite often. I've even tried writing a quick "dummy" macro to see if it was some sort of code error related to the macro, but got the same result. My "Close without saving" code is below (super basic code).
Sub Close_Without_Saving()'' Close_Without_Saving Macro' Closes active workbook without saving changes.'' Keyboard Shortcut: Ctrl+q' ActiveWorkbook.Close (False)End Sub
I have a macro to collate data from multiple workbooks to a single sheet. The folder path to the source files can be chosen thorugh the macro. It runs perfectly in my system running on Windows XP. But it doesnt run on Wondows 7 system. Both are using MS Excel 2010. In Windows 7 system, while choosing the folder path where source files are located, it says "No items match your search" (screenshot attached). I would want the macro modified so that it runs on any platform. The macros that I'm using is given below:
I have a 'dashboard' worksheet in 2010 and want to be able to click on a cell in this sheet and have it take me to the assigned worksheet. They are all in the same workbook. e.g if i click on Leadership i want it to take me to the Leadership tab, Skills to take me to the Skills tab etc The 'dashboard' will be the only viewable sheet in the workbook until one of the items on the page has been clicked.
I have a very basic understanding of macros and I'm not sure if this would work or if i should use a formula instead?
I developed a tool in Excel 2010 using macros and launched it to a group of dozens of users. Turns out one of them uses a mac and says it is incompatible. I have never used Excel for Mac or tested my tool in it. Next I plan to test it on a mac but how to make this work?
How/ where to save macros. If I save a macro "normally" ("in this workbook") then it only applies to that one file, right? And I can't use it in any new files.
So what do I do if I want a macro I can use in "all" my Excel files?
And can I email a file containing a macro to a colleague, so he can work on the file, using the macro too?
I ask, because I've had trouble with this in the past (tho in MS Word) where I couldn't get the macro to be emailed along with the file...
Also - how can I get an .xls file with a macro to work in newer versions of Excel? And can I use Excel 2010 to save a file with a macro in an .xls format, so it can be opened in older Excel versions too?
I have inherited support for a suite of Excel 2003 spreadsheets with complicated macros which run fine on XP. Having been tasked to test them on Windows 7 with Office 2010, I have not converted them as they are run by several sites globally who may not upgrade to Office 2010 at the same time. Hence they run in compatibility mode which in general is fine.
However, certain macros are veeeery slow and to the user would look like the app has hung. In debug I have found that the macro takes 10 minutes plus whenever it hits any of the following code:
Code: With Application .Calculation = xlAutomatic .MaxChange = 0.001 End With
ActiveWorkBook.PrecisionAsDisplayed = False It goes slow on each of the three 'lines' so it seems that it is actually doing an auto calc each time!
Is there some configuration I can do to prevent this? Setting auto calc to Manual didn't work and anyway I loose things, like data validation, when I save it in Excel 2010.
I have a macro-based employee leave system that works by couting the number of days shaded with a certain colour and thus calculating leave days taken, remaining and entitled... I have a single workbook with multiple sheets for different employees.
However, when I update by using ctrl alt f9, it updates all the other worksheets (ignoring their shading) with the values of the active worksheet! So if I update Peter, who has taken 14 days so far, it will update Liam's sheet too, with 14 days, ignoring Liam's actual shaded days...
How can I update each sheet individually, without compromising the other sheets?
I'm using excel 2010 and have inherited an old workbook that has seen many version updates over the years. The "view macros" list displays approx 25 macros and I know that not all are currently being used or necessary.
The main tab contains macro control buttons. Any macro not assigned to one of these controls is not necessary (it's probably old and was just never removed).
How can I determine which macros are "unassigned" to a control or otherwise invalid?
I have four cells c1 thru c4. The SUM of these cells must equal 1. I want to display an error message "sum of cells not equal to 1.0" but only when data has been entered in all four cells.
For instance =SUM(C1:C4, "<>1") should display the error message. Is there a way to write the formula with an IF statement and still use data validation with error message box?
Assumptions: -Will ignore blanks -Error message "Sum of cells are not equal to 1.0" until values in all four cells have been entered, not after a value is entered in a cell. (validate expression after all four cells have values or blank)
Scenarios: c1 = .25, c2 is blank, c3 = .25, c4 = .50 TRUE no error message should displays c1 = .25, c2 = .25, c3 = .25, c4 = .50 TRUE no error message should displays c1 = .25, c2 = .30, c3 = .25, c4 = .50 FALSE error message should display after value is entered in c4 etc
What I don't want is for the error message box to display after .25 is entered in c1 because the user is still in the process of adding values. Can this be done using Data Validation in Excel 2010?
We are in the process of switching from running Excel 2007 under Windows XP to running Excel 2010 under Windows 7. Most of my Excel reports are not having any issues. However, I have several macros that cause Excel to crash when they go to save the file. Through trial & error, I have found that the problem seems to occur after deleting custom lists that were created earlier in the macro. Here's the pertinent code:
' Declare Variables Dim VarListNum1 Dim VarListNum2 Dim VarListNum3
When I execute the macro line-by-line, it is creating & deleting the custom lists as expected. However, if I try to save the file after any of the custom lists have been created, Excel crashes. Has something changed in Excel 2010?
I have a workbook with numerous macros in it and they are assigned to buttons in the different worksheets. I am trying to record a new macro and when I start recording and click on one of the other macros nothing happens. This wasn't a problem in excel 2003.
I've created a spreadsheet at work that has two summary tabs which contain hyperlinks to around 30 separate sheet tabs.
On each sheet tab there is a list of unique values in column A (and other information relating to each value in columns B to D which are repeated for more than one unique value). In column E, users enter a test script name against each unique value they wish to 'reserve', and the macro picks out the unique test script names and via the COUNTIF formula counts the frequency of each test script name for each of the different values in column B.
My problem is that the macro seems to work fine if the workbook is not shared, but errors if the workbook is saved as shared. The error is 'Run time error 1004 - Unable to select the MergeCells property of the Range class'.
Here is the macro code:
Sub Get_Policies_Per_Script(updCol As Long, ShtName As String) Dim rowctr As Long Dim tgtrow As Long
Const ppsformula As String = "=COUNTIFS($A$3:$A$65000,I$24,$E$3:$E$65000,$G"
If updCol = 5 Then 'test name column has been modified
There are some excel documents in a hidden folder that contain sensitive information. Shortcuts to these documents will be provided to users to open them and add data. These documents contain all kinds of macros as well. Once macro disables the 'Save As' feature so that the workbook can not be saved outside of the hidden folder, preventing to some degree a user from saving as a different name and emailing the document with the sensitive data.
This all works fine with Macros enabled. As soon as macros are disabled the 'Save As' prevention is bypassed and the workbook can be saved anywhere.
Is there a way for an administrator to lock out the Trust Center options for disabling all macros?
I have an Excel 2010 spreadsheet that I am using to save several numbers all in the same column. These numbers can range from the several thousands up to billions. The formatting I am using for these numbers is Number (using 1000s separator).
I am also using the spreadsheet to generate a text string for each of the numbers. I don't want the text string to show the number as it is, I want to shorten the number by only showing the first few digits followed by a "B" for billion, "M" for million, or "K" for thousand. For example, in the text string I want to show 1,600,000 as 1.6B.
In order to shorten the number I use the cell in the column to the right of each number. This cell uses the following custom formatting (which I found by doing a Google search): [>999999999.999]#.0,,,"B";[>999999.999]#,,"M";#,"K";
As you can see the formatting is quite complex (at least for me it is) but it does what I want it to do.
Here is a screenshot of what the original and custom formatted cells look like:
As you can see the custom formatting works and does exactly what I wan
The next column (after the custom formatted number) is where I put the generated text string for each of the numbers. As I stated above, I want the generated text to use the shortened version of the number (e.g. 1.6B).
To generate the text I use the CONCATENATE function with a reference to the cell containing the shortened number as one of the arguments. For example:
CONCATENATE("SOME STRING ", B1)
Where B1 is the custom formatted cell.
The problem I am running into is, the text that gets generated doesn't show the shortened format of the number, it shows the full number. Here is a screenshot demonstrating what is happening:
As you can see the generated text is "SOME STRING 1600000000". This is not what I want. I want the generated text to be "SOME STRING 1.6B".
I think I understand what's going on. When the CONCATENATE function references a cell it takes the actual value of the cell and ignores any formatting. (I suppose formatting is just the way you see the data, not how underlying functions receive the data.)
My question is, how can I re-write the CONCATENATE function (or use another function, etc. available to me) to use the formatted version of the cell?
*UPDATE* I have attached my spreadsheet as an attachment to this post (tackyjan_excelforums.xlsx). Please note that it was created and saved using Excel 2010.
I'm a fan of the Excel 2010 table styles, but can't figure one thing out. When I create a table in excel (Ctrl+T), I like to reformat it with a new defined style. When I save the style, I can use it while I'm in that instance of excel, but when I close and reopen excel, the style is gone. How to save the custom formats to they are always available?
I am running excel 2010 with windows 7. I created a macro in sheet 1 and I wish to activate the macro from sheet 2 using a form button. I have entered the code below. I know how to perform this function on a more simple macro like adding names to cells. This code is a bit more complex I just dont know where to start.