Results 1 to 5 of 5

Thread: Save Workbook For Each Change Made In A Range

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    Use this in the code module of the specific sheet where you make changes

    Code:
    Private Sub Worksheet_Change(ByVal Target As Range)
    
        If Not Application.Intersect(Target, Range("C:C")) Is Nothing Then
            Application.DisplayAlerts = False
            ThisWorkbook.Save
            Application.DisplayAlerts = True
        End If
        
    End Sub
    Last edited by Excel Fox; 03-22-2013 at 08:51 PM. Reason: Changed SelectionChange To Change
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

  2. #2
    Junior Member
    Join Date
    Mar 2013
    Posts
    17
    Rep Power
    0
    Apologies, just realised the code is added into my existing, not as a new code

    Code:
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim Cell As Range
    Dim myPassword As String
    myPassword = "UnknowN"
    For Each Cell In ActiveSheet.UsedRange
    On Error Resume Next
    MyCase = UCase(Cell)
    If MyCase = "TARGUS" Or MyCase = "YELLOW" Or MyCase = "RAIL" Or MyCase = "IONS" Or MyCase = "EONS" Or MyCase = "WEBSTORE" Or MyCase = "TV" Or MyCase = "CAPTIAL RENT" Or MyCase = "QUICK" Or MyCase = "LIONS" Or MyCase = "GAME" Or MyCase = "DIRECT" Or MyCase = "NEST" Or MyCase = "HELPER" Or MyCase = "OTTER" Then  ' add more if needed
    Application.EnableEvents = False
    Application.Undo
    Application.EnableEvents = True
    ActiveSheet.Protect Password:=myPassword ' Password you have to change what you want
    MsgBox "Incorrect Entry" & vbCr & vbCr & "Please use the correct sheet", vbCritical
        ThisWorkbook.Close savechanges:=True
    End If
    Next
        If Not Application.Intersect(Target, Range("C:C")) Is Nothing Then
            Application.DisplayAlerts = False
            ThisWorkbook.Save
            Application.DisplayAlerts = True
        End If
    End Sub
    Last edited by Stalker; 03-22-2013 at 08:35 PM. Reason: PS - Thankyou very much for the code!!

Similar Threads

  1. Replies: 4
    Last Post: 07-02-2013, 11:32 AM
  2. Replies: 8
    Last Post: 04-16-2013, 02:04 PM
  3. How To Save Macro To Personal Workbook
    By NITIN SHETTY in forum Excel Help
    Replies: 1
    Last Post: 04-07-2013, 01:07 PM
  4. Change Display Range Based On Change of Dropdown Values
    By rich_cirillo in forum Excel Help
    Replies: 2
    Last Post: 03-29-2013, 04:58 AM
  5. Copy Sheets To New Workbook And Save
    By Prabhu in forum Excel Help
    Replies: 5
    Last Post: 09-06-2011, 09:35 PM

Posting Permissions

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