Consulting

Results 1 to 3 of 3

Thread: Workbook Sequencing Only on Saves

  1. #1

    Question Workbook Sequencing Only on Saves

    Hey Guys and Gals Ive been practicing with VB lately and let me tell you this stuff is pretty interesting, how much do programmers make anyway??

    I wrote a bit of code and it works fine and everything but it seems to do the job only slightly...

    Option Explicit
    Private Sub Workbook_Open()
    Sheets("Sheet1").Range("A1").Value = Sheets("Sheet1").Range("A1").Value + 1
    ThisWorkbook.Save
    End Sub

    I am using this to create a purchase ordering system since quickbooks is too overwhelming..I would like it to only sequence on saves so that I could have an accurate count of orders at the end of every month..with this code itll sequence regardless if I save or not, do you think you can help? Thanks!!

  2. #2
    Try this:
    Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
        Sheets("Sheet1").Range("A1").Value = Sheets("Sheet1").Range("A1").Value + 1
    End Sub
    (also in the thissworkbook module, remove the Open event you currently have)
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  3. #3
    It works like a charm, Super Thanks!!

Posting Permissions

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