Saving the file when a new value is entered

  • I have a situation where I have a list of employee names.


    the Spreadsheet contains 7 columns and only one the (the last column) will contain a value. The columns can text and dates.


    How could I set it up on the Selection change event that whenever the cell that contains the value (not the text or date cells) the workbook will save>


    right now, I have this (which saves everytime a cell is "dirtied"):


    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Value > 0 Then ThisWorkbook.Save
    End Sub


    I was trying to use the IsNumeric function but wasn't able to get it to work.


    thanks for your help

  • Re: Saving the file when a new value is entered


    Hi bear cub
    Change the column number to your last column number

    Code
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    'IF column "E" then save the workbook
    If Target.Column = 5 Then ThisWorkbook.Save
    End Sub


    Hope this helps.


    Bill

    [FONT="Arial Black"][COLOR="blue"][SIZE="4"]Bill[/SIZE][/COLOR][/FONT]
    Tip: To avoid chasing code always use Option Explicit.

  • Re: Saving the file when a new value is entered


    Thanks Bill,


    works fine. I thought it was something like that but I didn't know how to put into code.


    I image that you could also use this for a row as well, correct?

  • Re: Saving the file when a new value is entered


    correct


    Target.Row

    [FONT="Arial Black"][COLOR="blue"][SIZE="4"]Bill[/SIZE][/COLOR][/FONT]
    Tip: To avoid chasing code always use Option Explicit.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!