1. M

    VBA - How do I stop a Routine if the user cancels one of the Userforms

    I have a Sub Routine to help users add a new tab to a spreadsheet. It starts by opening a userform where they enter the name of the new tab. The userform then closes and the VBA then searches to see if there is already a tab with that name - if there is the user gets a message to say it already...
  2. J

    How stop a code if 'Cancel' is clicked in the file dialog box

    I'm using the below code to bring up the file dialog box so the user can select a file path to save a file. What I want to do is stop an error from occuring when the user clicks the 'Cancel' button in the dialog box. Currently when you click 'Cancel', it comes up with 'Run-time error '5'...
  3. T

    Len() function

    Private Sub Form_BeforeUpdate(Cancel As Integer) Dim strMissingInfo As String Dim strMsg As String If IsNull(Me.[Debarred]) Then Cancel = True strMissingInfo = strMissingInfo & "Debarred" End If If IsNull(Me.[Restricted]) Then Cancel = True...
  4. I

    Apply text to a cell userform to worksheet in current working code

    Good morning, The code in use is supplied below. Currently when i press my Postage Sheet Transfer Button the values are added to my worksheet and the cell in column G is applied the interior RGB colour Red. Please can you advise how i also have text in the same cell, so not only is it then...
  5. J

    VBA User Selected Range Error on Cancel

    I have been using this bit of code to get a user selected column (uses worksheet and string inputs). HOwever, if the user selects cancel, it errors out. Interestingly, it was working until I declared all my variable types. Any idea how to work around the error? Thanks, Justin Private...
  6. E

    "Saving" Notification/Status window not closing after VBA Save

    Though currently on Office 365 I have experienced this issue in earlier versions as well. I am using the ActiveWorkbook.SaveAs command to save a new workbook. The save is successful; however the Saving status window does not close. In order to continue processing I must select Cancel...
  7. L

    If cell is Empty!

    Hi all, I am trying to check for all sheets if specific call E10 is empty and it prevents user from saving. Currently it is only working on the sheet that i am on. It does not work on the others, i want to make it that it checks all check for a specific cell before saving. This is currently...
  8. H

    Value Odd in cell Vba Code....

    Hey i need some help with this code Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) On Error Resume Next If Not Intersect(Target, Range("F10:R19")) Is Nothing Then Target.Value = Target.Value + 1 Target.Value = Target.Value / 2...
  9. K

    Trying to reduce repeating code

    I have a userform with three textboxes that collect a search term: search1, search 2, search3. The search value runs through a function generating a list which populates listboxes: listbox1, listbox2, listbox3. If an item in the listbox is doubleclicked then it runs an Instr function selecting...
  10. M

    Ignore right mouse click on form control

    Hi gurus in the sky I use form control buttons to make life easy for my users. I want to disable a right click totally. I have discovered how to disable the "cut, copy, paste etc" menu by pasting into ThisWorkbook Private Sub Workbook_SheetBeforeRightClick(ByVal Sh As Object, ByVal Target...
  11. G

    Prevent "Backwards" Tab in Userform

    I have a userform with a bunch of text boxes, and on the bottom a Submit and Cancel Button. I want to be able to tab through these, but because the Cancel button is the last in the TabIndex, if a user is holding Shift and presses tab, it will go "backwards" to select the cancel button. Is there...
  12. albertc30

    TextBox format validation...

    Hi all. Firstly, as always, a much big thank you for all the help provided in the past and currently. This is much appreciated. Secondly, another issue. This issue being I have a textbox for customer phone. I need to format this to only allow 11 digits, no more, no less, it can't use...
  13. M

    VBA Code to clear contents Not formulas on spreadsheet

    Hi can anyone help please, I have the following code that clear the contents as well as the formulas on my spreadsheet. Can any tell me please how not to clear the formulas . Thanks Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean) 'Modified 6/18/2019 3:09 PM...
  14. J

    Remove conditions

    Okay, I am having a total brain fart and should be able to figure this out.. This is part of the code for one function in my massive dBase. As you see it's a Yes, No, Cancel call. I want it to default to NO all the time and go right to the IF statement, without it popping up the Yes, No...
  15. H

    Disable Save and Save As

    I want to disable both Save and Save As - I have VBA that saves the document specifically for the user and I don't want them to try and save it as their own file. I have this: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If SaveAsUI = True Then...
  16. M

    Help with existing code

    Hi can anyone please help I have the following VBA Code that works great but what I know would like to do is rather than the code copy the first 4 cells on a row when I double click, let’s say cells A1-A4, can the code not touch and leave cell A3 alone . So even if I was to modify the code...
  17. Jaafar Tribak

    'Auto_Close' missing 'Cancel' argument

    Hi, I looked at a question posted in the forum which intrigued me to wonder if there is some way to abort the closing down of a workbook within the excel AutoMacro Auto_Close . Something similar to setting the Cancel arg to True in the Workbook_BeforeClose event. Any thoughts ? Regards.
  18. RobbieC

    Custom 'cancel' on Auto_Close

    Hi there, I have a 'very customised' spreadsheet which I have replaced all alert boxes with customised userforms. I have a form called CloseAreYouSure which is triggered when Auto_Close kicks in. This just confirms whether or not the application is to close down with a 'yes' & 'no' button: Sub...
  19. C

    Vba MsgBox - Question for cancelling!

    Hi everyone Hope you can help. I am using a button to run the below code which prints specific data to a PDF, though first it checks to see if cell M21 is blank. If it is then it prompts the user to warn them if they want to proceed or cancel. If they proceed or if cell M21 is NOT blank then...
  20. G

    Doubleclick Yes, No and Blank - VBA

    Hello everyone, I found a Code for VBA to use double click in certain cell to activate Yes and No. However, I cannot to add to that code that it also show blank (or returns to the default result aka do not show anything). Can anyone help me please? P.s I am newbie. Code: Private Sub...

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back