I'm trying to disable the [x] in the upper right hand corner to force my users to use my "Close Workbook" button, but not sure how to do it. Then, was thinking that I might just want to hide the entire Application Title bar...
I want to hide all toolbars and disable the red X upon opening of the spreadsheet, and to restore the main toolbars upon closing. That worked perfectly. (when I used the black code -see below) I added in the red code as i wanted to disable the red X as well to ensure that users will always close the EXCEL worksheet via a Macro button.
The Macro will save the spreadsheet and close the worksheet and the Private sub should restore the toolbars.
I have a workbook that has a macro that needs to run before it is closed. I have a button on my sheet that runs that macro and then closes the sheet. Is there a way that I can disable the "X" at the top right hand of the workbook and force the user to close the workbook via my button?
I use to send reports to my seniors on daily basis. I want these reports to be with me and they can just open and check the reports, when I send them. If they try to save file through File-Save or File-Save As, they should not get these options at all in the File Menu.
I want to do is allow a user to choose entries from a data validation list and then they can remove the validation to make some edits to the selection. I have it set up so that they can do this by clicking on a command button that will remove validation for the selected cells.
What I want to now do is to be able to restore the validation in case they have made an error. My first thought was to have a hidden "Master" sheet that has all the relevant validation in it and then when the user picks a range to restore validation to, just copy the cells from the "Master" back to the working sheet (it should be noted that the range to restore validation to may contain cells with different validation). I'm sure the code for this is quite simple but I am still learning. The steps I want to do are:
1. Store the range of cells chosen on the worksheet 2. Go to the Master worksheet and select the same range 3. Copy the range from the Master worksheets back to the same range on the original worksheet.
I'm a beginner to VBA and I have a dataset with different loan rates for different schools. So far I can highlight rows based on their rate and order them from least to greatest.
What I want is to be able to restore all of the font to default (i.e. undo the highlighting) without changing the format of a specific column of cells (My G column, with the loan rates, goes from Percentage format to General format)
I'm using Selection.ClearFormats, which changes the format of the cells to general as well as it only restores the format of the cells I highlight, rather than the entire worksheet
So basically, how can I delete all formatting of all cells without changing the cell format (Percentage vs General)?
In a worksheet, I should have selected the region where data is present, and center align all the cells. Instead, I selected the entire worksheet and did the same, so that whenever new data comes in the relative cells are already formatted. This has caused the workbook size to increase dramatically. (So, I assume that changing a cell property from the default value uses some memory). Is there a way to restore the format of the blank cells to the default values, so that memory is freed and the workbook size decreases again?
I have a procedure that stores the Commandbar names and visibility settings in an array on open. Another procedure hides all Commandbars on open and restores their original visibility settings on close. For some reason the "Standard" and " Formatting" toolbars don't return to visible on close.
My error log says "08/13/07 18:21:37 [QA.xls]MCommandBars.bRemoveMenus(), Error -2147467259: Method 'Visible' of object 'CommandBar' failed". I have tried manually testing the hide/unhide procedure with hard coded settings and checked the correct variables are being sent and all seems to be correct.
I am pretty confident that the procedure to store settings is correct but have included the code just in case, also just noticed the "Standard" and "Formatting" toolbars are the only two visible at programme start.
Public gsaMenus() As String
Public Function bMenuSettings() As Boolean
Const sSOURCE As String = "bMenuSettings()"
Dim bReturn As Boolean Dim iCounter As Integer Dim cbrMenu As office.CommandBar
Any way to restore the default reference libraries that are checked the first time you open Tools => References in VBA in Excel 2013. I think I accidentally unclicked something that's necessary to run the program, and I can't find a "default restore" option or anything of that sort.
I need to create a macro that whenever the user clicks the restore down button it will not restore down, but either do nothing, or make the application display full screen. The following code runs when the workbook opens and whenever a different sheet is activated and I would like it to run when the user clicks the restore down button.
Private Sub Workbook_Open() Application. ScreenUpdating = False Application.DisplayFormulaBar = False Application.ShowWindowsInTaskbar = False Sheets("01").Select With ActiveWindow .DisplayHorizontalScrollBar = False .DisplayVerticalScrollBar = False .DisplayWorkbookTabs = False End With............................
I managed to implement a macro that adds a time/date stamp in Column A when any of the subsequent cells in that row are changed. With this now working, I really need the ability to restore the undo history in case a change to the data needs to be reverted.
Private Sub Worksheet_Change(ByVal Target As Range) Dim c As Range Application.EnableEvents = False For Each c In Target If c.Column > 1 And c.Column < 21 Then Cells(c.Row, 1) = Now End If Next c Application.EnableEvents = True End Sub
I haven't used List Boxes much previously but decided to use one in this instance because I wanted the capability to make multiple selections. I used the following in a list box called "ListBox_Analysis_Code":
I am trying to create a worksheet that has multiple radio buttons. Each radio button is linked to a Macro. I need there to be many buttons running down one side of the worksheet. Each button needs to perform a macro that is relevant to the cells in the same row that it is on.
Essentially what i am trying to do is make a macro that when the button is pressed copys data from H6 and paste it into B6. The button is situated above I6. I need a button for each row from 6 to 110.
While this macro is easy to create (i use the record button and then assign the macro to the button), i would have to do this 104 times and assign a new macro to each button.
Is it possible to change the color of buttons or command buttons? There does not seem to be any place that allows this under properties for buttons, although there does for command bars. However, I've tried recording a macro as I change the color, but nothing get's recorded so I'm not sure what the syntax would be.
I have a spreadsheet with several buttons and I'd like them to change colors as they are pressed so it's possible to see what you've already done. And then, as soon as any other cell on the sheet is changed, the buttons reset color.
It’s been working perfectly up until around an hour ago. However, now when I close Excel, I get compile errors.
These compile errors seem to be because Excel is trying to access controls in the workbook after it has closed. Since the workbook is closed, VBA can no longer ‘see’ the controls, and therefore it thows up errors.
I’m also getting a similar error on a Worksheets("DataExplorer").unprotect line, which seems to be because the worksheet isn’t there after closing.
These errors only occur when I close the whole excel application using the big cross in the top right. If I just close the workbook (using the smaller cross just below the big cross in the top right of excel), it doesn’t throw up these errors.
Just to clarify: all of the code runs perfectly when Excel is open. The errors are being thrown up for lines of code which run without problem until Excel is closed.