+ Reply to Thread
Results 1 to 5 of 5

Userform - problem command "save" (i.e. Edit/modify) button

  1. #1
    Forum Contributor
    Join Date
    10-07-2015
    Location
    cyprus
    MS-Off Ver
    Microsoft 365
    Posts
    182

    Userform - problem command "save" (i.e. Edit/modify) button

    Dear all,

    On my userform, the command "save" which is supposed to overwrite in the excel datasheets the changes made through the userform does not work. It works only on the few last reference but not on any of them. My knowledge in VBA being more than limited, could you have a look and tell me where is the mistake

    here is the code

    [CODE][/Private Sub SAVECMD_Click()
    Dim IROW As Long
    Dim IROW1 As Long
    Dim WSH As Worksheet
    Dim WSH1 As Worksheet
    Set WSH = Worksheets("RECAP")
    Set WSH1 = Worksheets("PRICING FINAL")


    IROW = WSH.Cells.Find(WHAT:=Me.REF.Value, LookIn:=xlValues, SearchOrder:=xlRows, SearchDirection:=xlPrevious).Row
    IROW1 = WSH1.Cells.Find(WHAT:=Me.REF.Value, LookIn:=xlValues, SearchOrder:=xlRows, SearchDirection:=xlPrevious).Row

    Me.REF.Value = WSH.Cells(IROW, "C").Value
    WSH.Cells(IROW, "A").Value = Me.MONTH.Value
    WSH.Cells(IROW, "D").Value = Me.OIC.Value
    WSH.Cells(IROW, "E").Value = Me.VSL.Value
    WSH.Cells(IROW, "F").Value = Me.GRADE.Value
    WSH.Cells(IROW, "G").Value = Me.LP.Value
    WSH.Cells(IROW, "I").Value = Me.CT_QTY.Value
    WSH.Cells(IROW, "J").Value = Me.TOLERANCE.Value
    WSH.Cells(IROW, "L").Value = Me.SUPPLIER.Value
    WSH.Cells(IROW, "M").Value = Me.TERM_P.Value
    WSH.Cells(IROW, "N").Value = Me.CT_DATES_TERM.Value
    WSH.Cells(IROW, "O").Value = Me.CT_DATES.Value
    WSH.Cells(IROW, "R").Value = Me.LP_INSP.Value
    WSH.Cells(IROW, "S").Value = Me.LP_INSP_SHARING.Value
    WSH.Cells(IROW, "U").Value = Me.LP_AGT.Value
    WSH.Cells(IROW, "V").Value = Me.LP_AGT_CATEGORY.Value
    WSH.Cells(IROW, "W").Value = Me.RCVRS.Value
    WSH.Cells(IROW, "X").Value = Me.TERMS_S.Value
    WSH.Cells(IROW, "Y").Value = Me.DP.Value
    WSH.Cells(IROW, "Z").Value = Me.REQ_MIN_QTY.Value
    WSH.Cells(IROW, "AA").Value = Me.REQ_MAX_QTY.Value
    WSH.Cells(IROW, "AD").Value = Me.DP_INSP.Value
    WSH.Cells(IROW, "AE").Value = Me.DP_INSP_SHARING.Value
    WSH.Cells(IROW, "AG").Value = Me.DP_AGT.Value
    WSH.Cells(IROW, "AH").Value = Me.DP_AGT_CATEGORY.Value
    WSH.Cells(IROW, "AI").Value = Me.BL_DATE.Value
    WSH.Cells(IROW, "AJ").Value = Me.COD_DATE.Value
    WSH.Cells(IROW, "AK").Value = Me.BL_GROSS_QTY.Value
    WSH.Cells(IROW, "AL").Value = Me.BL_NET_QTY.Value
    WSH.Cells(IROW, "AM").Value = Me.OT_QTY.Value
    WSH1.Cells(IROW1, "M").Value = Me.INV_QTY_P.Value
    WSH1.Cells(IROW1, "O").Value = Me.PRICING_P.Value
    WSH1.Cells(IROW1, "P").Value = Me.PMT_P.Value
    WSH1.Cells(IROW1, "R").Value = Me.OSP_P.Value
    WSH1.Cells(IROW1, "S").Value = Me.PREM_P.Value
    WSH1.Cells(IROW1, "AE").Value = Me.INV_QTY_S.Value
    WSH1.Cells(IROW1, "AG").Value = Me.PRICING_S.Value
    WSH1.Cells(IROW1, "AH").Value = Me.PMT_S.Value
    WSH1.Cells(IROW1, "AJ").Value = Me.OSP_S.Value
    WSH1.Cells(IROW1, "AK").Value = Me.PREM_S.Value
    WSH1.Cells(IROW1, "BB").Value = Me.MIN_FRT_QTY.Value
    WSH1.Cells(IROW1, "BC").Value = Me.WS.Value

    End Sub
    CODE]

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform - problem command "save" (i.e. Edit/modify) button

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    PS Can you add code tags when posting code?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    10-07-2015
    Location
    cyprus
    MS-Off Ver
    Microsoft 365
    Posts
    182

    Re: Userform - problem command "save" (i.e. Edit/modify) button

    here a sample of the workbook

    and sorry I mistype the Code quotes

    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Userform - problem command "save" (i.e. Edit/modify) button

    There's no button named SAVECMD on either userform in the workbook.

    Both userforms do have a button named CMDADD.

    Which button/userform should we be looking at?

  5. #5
    Forum Contributor
    Join Date
    10-07-2015
    Location
    cyprus
    MS-Off Ver
    Microsoft 365
    Posts
    182

    Re: Userform - problem command "save" (i.e. Edit/modify) button

    Is this ok now?
    Attached Files Attached Files

+ 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. Command Button to "Save As". Setting Cell value as file name
    By seanturner9005 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-29-2013, 12:20 PM
  2. Create a Command Button to "Save As" and "Close" an Excel Workbook
    By thedunna in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-26-2013, 05:38 PM
  3. [SOLVED] Need a save and close macro that does not care if the "edit workbook" button has be clcked
    By rt3 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-22-2013, 08:42 AM
  4. Program excel command button to "save, lock and email" either with a macro, or VB.
    By testing the water in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2013, 11:26 AM
  5. Help with command button to Save/Lock/Email when the "completed" button is selected.
    By testing the water in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-09-2013, 04:06 PM
  6. [SOLVED] Replace "insert function" with "edit formula" button in fourmula b
    By 13brian in forum Excel General
    Replies: 0
    Last Post: 08-24-2005, 04:05 PM
  7. [SOLVED] set up a command button or macro for open file to "save as"
    By Mo in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-22-2005, 07:19 PM

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