exit

  1. M

    Save all sheets to PDF

    Hi, Looking for VBA to save all sheets to PDF. Currently i have the below, but only saves the active sheet. Thanks. Private Sub CommandButton8_Click() Dim sPath As String Dim sFile As Variant Dim ws As Workbook On Error GoTo ErrHandle sPath = ThisWorkbook.Path & "\" &...
  2. S

    Run Time Error '91' : Object Variable or With Block not Set

    Am getting run time error on green marked line. Anyone please help to resolve this error. Sheets("Sheet2").Select Columns("A:A").Select lr = Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row Set r3Search = Sheets("Sheet2").Range("A1:A" & lr) Set r3Search2 = Sheets("Sheet2").Range("A1:A" &...
  3. A

    Exit Function inside With-End With block

    Is this acceptable practice ?
  4. G

    Select Previous Cell

    Hello, Have the following code which works except it highlights the entire area it posted the data after doing the macro instead of just staying where the cell originally was. How can I get it to stay on cell B2 after running this code? Private Sub Worksheet_SelectionChange(ByVal Target As...
  5. I

    Could you check my code please

    In my worksheet i have a code where when i type a number in a cell in column A its matched photo of which i have named the same as the entered number is automatically placed into the same row but in column B So A50 i type 123456 when i leave that cell automatically the photo 123456 is now shown...
  6. P

    How to insert a character while the user is still typing

    Is there a way to insert a character while the user is still typing. For example if the user is entering the date, automatically insert either a "-" or "," or "/", or a "." after the first two characters. For this instance I just need to insert the character after the two digit month followed by...
  7. MFish

    How to find duplicates in two separate cells

    I have a code to check for a duplicate in column B7 and downward. I need to somehow configure it so it finds a duplicate in row B7-downward AND C7-downward. Here's the kicker... I need it to be like an "AND" function. It will be OK if the unique ID's are duplicated in column B as long as the...
  8. MFish

    Limit users to combobox list

    I have the property set to, "Match Required" for my comboboxes. I have a clear button that resets all of the values of my comboboxes to nothing, "". It keeps saying the selection is invalid after the clear button is pressed. I'll then fill out the form with the correct information and I'll...
  9. G

    Active Cell to Run Macro

    Hello! In columns B2:B20 I have the Names of all the other sheets in the workbook and each sheet has information in it. What I want to be able to do is click on, let's say B4 and it references the appropriate Sheet name and pulls that data range to L2 and continue that process for each B:B...
  10. D

    make them push a button on exit

    HI ALL i this code to save my sheet as a pdf using info from cell c2 Private Sub CommandButton1_Click() ActiveSheet.ExportAsFixedFormat _ Type:=xlTypePDF, _ filename:="C:\release" & Range("C2") & ".pdf", _ OpenAfterPublish:=False, _ IncludeDocProperties:=True, _...
  11. M

    Macro to find and replace values in several columns of a table

    Hi, I have the following macro which replaces the data in cells that are not blank within several columns in an Excel table, however the macro takes more than two hours to run due to the size of the table (40,000 rows and 50 columns). Is there a more efficient code I could use that would...
  12. D

    force a command button to be pushed before exit

    how do i force a command button to be pushed before exit.
  13. V

    Frustrating Excel VBA problem (Newbie with decades of experience, but apparently not enough)

    This is excel 2019 being extended with vba. Trying some simple, nonsense first.... and then.... FRUSTRATION the following code snippet is used as follows Cell #f21 has a value of tograms(a21,b21,16) A21 is typed as a numeric and has a value of 16 B21 is typed as text and has a value of “oz” 16...
  14. H

    Input date if Date + 30 days < current month and year

    I have the following code below I would like the input box to appears to input the date only if the date in A3 on sheet BR1 +30 < date , otherwise exit sub It would be appreciated if someone could amend my code Sub Date_Input() Sheets("Sales").Select Dim MyDate As String...
  15. S

    Userform Closing Excel

    Hello, I have a userform that has decided that it is going to close excel each time I use it. I'm not sure where I've gone wrong in my coding and was hoping someone could double check it for me. thanks! Private Sub CommandButton5_Click()'"next" page button On Error GoTo Helper...
  16. T

    How to make user input .Value entered as specified British date format and not auto-ing to American

    For example I enter 01/05/19 The 1st of April 2019 in my userbox Exit the macro 05/01/19 is entered in the cell instead. Sheets("View").Range("B3").Value = Me.Specifictext.Value I can only assume this is a Microsoft feature that reverts the value to American.
  17. W

    Help with Run-time Error '91' with code

    I have a userform that I am trying to get working. I have the inputs all set, make the validation, set it if correct but can't seem to get past the 'copy the data to the data base'. Here is my code: Private Sub CommandButton_Add_Click() '----------------------------------------------------...
  18. S

    Error Checking

    So I've written this error coding. I was hoping someone could check it over and tell me 1. why userform18 won't show when running and 2. Is there coding I can put in userform 18 that would allow me to "screenshot" a highlighted string of code (the code that error'd) and screenshot (or save as a...
  19. S

    Error Handler

    Have I written the following piece of code out correctly for handling errors? The XXX for error code is my own reference sheet of "error codes" so I can see which of the 187 modules (talk about a mess...) has an error and the other error code should come from excel. I want this to allow the...
  20. MCTampa

    VBA Exit Do Then Run Something Else

    I have a line of code which works. Do... If .....then Exit Do When the code is satisfied the loop stops, but I want it to move on to a next step and I am not sure how to do this.

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 MrExcel.com.
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 "mrexcel.com".
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
Back
Top