+ Reply to Thread
Results 1 to 8 of 8

VBA Save if cell is not less then 3

  1. #1
    Forum Contributor
    Join Date
    11-08-2011
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    279

    VBA Save if cell is not less then 3

    Hi All,

    I am trying to save a document using a button if the value is 3 or more. I have the below code which stops the document from saving and comes up with a message box.

    The issue is that it carries on going through the code and then turns into a run time error 1004

    What i need it to do is when it shows the message box for it to stop running the rest of the code.

    Please Login or Register  to view this content.
    Thanks

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: VBA Save if cell is not less then 3

    Add Exit Sub before End If?

  3. #3
    Forum Contributor
    Join Date
    11-08-2011
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    279

    Re: VBA Save if cell is not less then 3

    Hi Kenneth,

    Thanks for the response. I have amended the code to the below but it is still coming up with the same error.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: VBA Save if cell is not less then 3

    Removed, too many errors in code.
    Last edited by jason.b75; 01-02-2019 at 01:05 PM.

  5. #5
    Forum Contributor
    Join Date
    11-08-2011
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    279

    Re: VBA Save if cell is not less then 3

    Thanks jason.b75 but still coming up with the same error.

  6. #6
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: VBA Save if cell is not less then 3

    Which line is causing the error?

    Application.Sheets stands out as wrong, although I've never tried it to see if it does work.

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    11-08-2011
    Location
    Leeds
    MS-Off Ver
    Excel 2010
    Posts
    279

    Re: VBA Save if cell is not less then 3

    Thanks for looking at this jason.b75

    i have changed the code to incorporate the above and it still coming up with the 1004 netgid saveas error

    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    06-08-2012
    Location
    Left the forum!
    MS-Off Ver
    Left the forum!
    Posts
    5,189

    Re: VBA Save if cell is not less then 3

    There seems to be a mix of issues between various edits, I just noticed a novice error in the change I made in post #4.

    Try this variation
    Please Login or Register  to view this content.
    If you still get issues, hit the Debug button on the error message and tell us which line is in yellow.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel doesn't change the cell format on save through the workbook save button
    By mitko1994 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-16-2017, 03:09 PM
  2. Replies: 1
    Last Post: 04-29-2016, 11:55 AM
  3. Replies: 1
    Last Post: 02-04-2015, 03:27 AM
  4. [SOLVED] Macro to save file - save name from cell containing a date using different date formatting
    By d_max_c in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-15-2014, 12:18 PM
  5. Replies: 0
    Last Post: 11-22-2012, 08:42 AM
  6. Macro with cell reference as a name, but prompt for save location and save as csv
    By tomham in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-15-2012, 06:21 PM
  7. auto save with cell value in save name
    By sleepwaker83 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-10-2010, 07:26 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1