Results 1 to 8 of 8

Update Values based on status update

Threaded View

  1. #1
    Forum Contributor
    Join Date
    01-14-2010
    Location
    England
    MS-Off Ver
    2013
    Posts
    110

    Update Values based on status update

    Hi,

    Hope somebody can help, I have the below code but I need help making a few changes. At the moment it -1 if the status is set to "used" and +1 if changed to "returned". However, I would now like it to also look at column 12 (L) for a second status. If column 12 is set to "damaged" or "faulty" I would like it to -1. The other problem is that if I select "used" or "returned" and then select the same status again it changes the value again. So, if i select "used" it will deduct one and then if I select it again my mistake it will deduct another one.



    Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Column = 11 Then
        Cancel = True
    End If
    End Sub
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    If Target.Count = 1 And Target.Column = 11 Then
        mystring = Range("A" & Target.Row) & Range("C" & Target.Row) & Range("E" & Target.Row) & Range("F" & Target.Row)
        With Sheets("PartsMaster")
            lr = .Cells(.Rows.Count, 1).End(xlUp).Row
            ReDim arr(1 To lr)
            For x = 1 To lr
                arr(x) = .Range("A" & x) & .Range("C" & x) & .Range("E" & x) & Range("F" & Target.Row)
                If arr(x) = mystring Then
                    myrow = x
                    If Target = "Returned" Then .Cells(myrow, 7) = .Cells(myrow, 7) + 1
                    If Target = "Used" Then .Cells(myrow, 7) = .Cells(myrow, 7) - 1
                    
                    Exit For
                End If
            Next
        End With
    End If
    End Sub
    Hope this makes sense.

    Cheers
    Last edited by JDobbsy1987; 03-12-2017 at 09:38 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 05-13-2014, 01:00 AM
  2. Changing the value in Combobox after update
    By jik_ff in forum Access Programming / VBA / Macros
    Replies: 0
    Last Post: 04-17-2014, 09:34 PM
  3. Update link (Update values) on a protected sheet excel 2010
    By sonu1975 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-03-2014, 09:49 AM
  4. Replies: 5
    Last Post: 12-11-2012, 01:22 PM
  5. Update Cells after changing UDF
    By strokebow in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-03-2011, 10:15 AM
  6. changing cell color based on changing values
    By tvonbehren in forum Excel General
    Replies: 2
    Last Post: 09-16-2009, 12:33 PM
  7. Update date when changing a cell
    By leonidas in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-14-2006, 06:20 AM

Tags for this Thread

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