+ Reply to Thread
Results 1 to 3 of 3

Save Update Code Paint Detail Sheet

  1. #1
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    932

    Save Update Code Paint Detail Sheet

    Hello,

    On the Paint Detail sheet there is code to save record. Can the code be modified so it updates the existing record instead of adding a new record? There shouldn't be duplicate paint code names.

    Thank you for your help
    Attached Files Attached Files

  2. #2
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Save Update Code Paint Detail Sheet

    Try this code :...

    PHP Code: 
    Sub Paint_Save()
    ActiveSheet.Unprotect
    With Sheet2
        
    If .Range("E5").Value = Empty Then
            MsgBox 
    "Please enter a paint code"
            
    Exit Sub
        End 
    If
        
    PaintRow Evaluate("=Iferror(Match(E5, D:D, 0),99999)"' new code: PaintRow = 99999, old code: PaintRow = row_Index
        If PaintRow <> 99999 Then ' 
    if old code
            
    If MsgBox("Its about to edit information! Continue?"vbYesNo) = vbNo Then Exit Sub
        
    Else ' new code
            PaintRow = .Range("D99999").End(xlUp).Row + 1     '
    First available Row
        End 
    If
        For 
    PaintCol 4 To 7
        
    .Cells(PaintRowPaintCol).Value = .Range(.Cells(11PaintCol).Value).Value
        Next PaintCol
        
    .Range("B3").Value False
    End With
    ActiveSheet
    .Protect
    End Sub 
    Quang PT

  3. #3
    Forum Contributor
    Join Date
    02-26-2023
    Location
    Lousianna
    MS-Off Ver
    Microsoft 365
    Posts
    932

    Re: Save Update Code Paint Detail Sheet

    Thank you very much @bebo021999. Your code works great!

+ 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. [SOLVED] VBA Save Essential Information From Job Detail Sheet To Job Detail DB Sheet Table
    By billy60 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-09-2023, 05:11 AM
  2. Replies: 6
    Last Post: 12-19-2022, 12:17 PM
  3. VBA code update - save as PDF based on value
    By forfiett in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-08-2016, 03:23 AM
  4. save paint
    By eran3185 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-30-2012, 02:35 AM
  5. save a paint file as jpeg
    By eran3185 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-30-2012, 01:55 AM
  6. Replies: 0
    Last Post: 09-14-2009, 08:11 AM
  7. if blank cells, paint yellow. if cell to left is less than a number, don't paint
    By curbster in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-09-2009, 02:40 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