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 currently have a vba that when execute, a message box pops up that allows me to name the tab. I'd like to add a line that closes the input box when I press the red ex or when I press cancel. Currently, when I press cancel, another annoying box pops up but ultimately there is no way to close out once it starts. What line should I add to close it when pressing cancel or the red ex and where should I add it? find the code below:
I'm using the following code to create an Inputbox but I want to either disable the OK button until an entry is made or not allow a blank entry. Forcing the user to have to make an entry.
If NameTextBoxnew.Value = "" Then NameTextBoxnew.Value = Application.InputBox("You must input a name/nickname to identify person", "Name") End If If SexTextBoxnew.Value = "" Then SexTextBoxnew.Value = Application.InputBox("You must select a sex(m/f)", "Sex") End If If DOBTextBoxnew.Value = "" And AgeTextBoxnew.Value = "" Then AgeTextBoxnew.Value = Application.InputBox("Please insert a rough age in years", " Date of RSIT") End If
I am trying to create an advanced spreadsheet in excel that caters for people who really need to be told exactly what to do and what not to do. So based on the selection in column A I want to disable and change the background colour of some cells as follows (but only disable the cells on the same row):
columnA = Number then disable cells D, F, G and change to red columnA = Link then disable cells E, F, G and change to red columnA = Image then disable cells D, E and change to red
when i choose material from my combobox Options (cboTM), i wanted, only the textboxes regarding to the sheet material unlocked, and the others locked with the color of the form, and the same for the other options like worklabor and equipments. i could blocked for material with this code :
The prob is, worklabor and equipments will be blocked too, and i dont know how to put correct info on the textboxes.
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.
I need to know the command to close a workbook. I have used the information found here: http://www.ozgrid.com/VBA/userform-close.htm to disable closing the workbook via the upper right "X", but I need a button that, when clicked, simply closes the workbook instead.
I am trying to create a macro which gives me an input box. I need to enter 2 numbers into the input box. It would be as follows:
Input Box Msg 1 - "What is your labor cost?" (NUM1) Input Box Msg 2 - "What is your productivity rate?" (NUM2)
Then I need the macro to take this info and enter it into a formula which changes according to the row which you are on. (I need the macro to work based on which ever cell I currently have selected). The formula would be this if I currently had a cell on row 10 selected:
So, if I currently had cell L10 selected, and I ran the macro and put 100 in for "NUM1" and 10 for "NUM2" and my sheet had 20 in cell H10, then the macro would enter the number 1,000 into cell L10. If I had L500 selected, then the macro would enter the final number into cell L500 based on what value H500 contained.
I am just starting to get my feet a little damp with VBA and I am trying to make a macro that will act whenever any text is entered in any cell within a 3x3 square. Whenever any text is entered in any of those cells I would like it to enter a text ( "X" ) in a cell which is specified by a cell in the spreadsheet (this cell will output which cell the macro should write the text in in this format "A:1" or "C:3"). How can I make the program act only in reaction to the user entering thier text, and also, how can I get the macro to read A:1 and enter the text into that specific cell? Any help would be so awesome, the book I have is really difficult to navigate.
I am in need of VBA code so that I can fill out an input form generated by someone elses macro input box. (I am the user, not the one developing the input box).
I am working to streamline a whole cluster of macros and this input box is currently my bottleneck. When the input box pops up, instead of me manually typing, I want to autofill the space with "104" and then click 'ok' uisng VBA.
I can not modify the actual VBA that created the input box (ie make 104 the default) because other users need the box to be blank.
find out how a developer would change the original vba code, not how a user can interact with an input box by using vba.
Is there a way to disable 'Save as PDF or XPS' with the macro? I have tried disabling 'Save as' with the below VBA code but it does not disable 'Save as PDF or XPS'.
VB: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If SaveAsUI Then MsgBox "Save As is disabled", vbInformation Cancel = True End If End Sub
Also I have a macro which saves the excel report in a PDF format with 'Save as PDF or XPS' utility. I would like to enable 'Save as PDF or XPS' when this macro is started and again disable 'Save as PDF or XPS' when this macro stops.
Excel 2003 - VBA - How do you detect when a row has been deleted in VBA? Better yet, how do you detect when a row is about to be deleted? I also would like to know the row number. I do not see an event handler that will inform me of the "Delete" event.
I need to disable cut and drag only in a workbook. The idea is to avoid formula reference errors when unlocked cells are cut and pasted or dragged. I can find many macros online but none that do only these two things.