+ Reply to Thread
Results 1 to 8 of 8

Compile Error: Method or data member not found when i click Save button...

Hybrid View

  1. #1
    Registered User
    Join Date
    12-30-2012
    Location
    Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    8

    Unhappy Compile Error: Method or data member not found when i click Save button...

    Hello, I am a beginner in Excel VBA, I tried to make a simple UserForm for my office cashflow. the userform working just fine as it supposed to be, but when i try to click the Save command button, this error message always shows up... and it point to the save button line in VBA, Please advice... you can look up at my worksheet and pls tell me is there something wrong with it?


    thanks in advance for any help


    nb: the name and caption of the userform is using Indonesian Languange in case you wonder
    Attached Files Attached Files
    Last edited by aditbaco; 07-15-2013 at 07:04 AM.

  2. #2
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    16,029

    Re: Compile Error: Method or data member not found when i click Save button...

    You have uploaded .xlsx file. Not .xlsm
    Never use Merged Cells in Excel

  3. #3
    Registered User
    Join Date
    12-30-2012
    Location
    Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Compile Error: Method or data member not found when i click Save button...

    ah yes my bad

    attachment changed... hehe

  4. #4
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Compile Error: Method or data member not found when i click Save button...

    your form doesn't contain a control called TXTDesk
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  5. #5
    Registered User
    Join Date
    12-30-2012
    Location
    Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Compile Error: Method or data member not found when i click Save button...

    ah yes thanks... i forgot to add "box" in it.... the userform is working fine just now....

    a few more help pls....

    1. Why everytime i save the data, it added to row 25 instead of below A3 as i declared in here...
    RowCount = Worksheets("EXPENSES").Range("A3").CurrentRegion.Rows.Count
    With Worksheets("EXPENSES").Range("A3")
      .Offset(RowCount, 0).Value = UserFormKas.CBOJenis.Value
      .Offset(RowCount, 1).Value = UserFormKas.CBOTipe.Value
      .Offset(RowCount, 2).Value = UserFormKas.TXTBOXDesk.Value
      .Offset(RowCount, 3).Value = UserFormKas.CBOBulan.Value
      .Offset(RowCount, 4).Value = UserFormKas.TXTBOXJumlah.Value
    End With
    what am i supposed to add to the Code?

    2. How can i make the userform to add the "Jumlah" entry data to the respective month column that selected from "Bulan" Combo box in the EXPENSES sheet? Is there a way to make it happen? because ive read a few guide about it and still i couldnt find a thing...


    thanks for the help,,, I am sorry for my bad english,, just ask me if you dont get my words

  6. #6
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Compile Error: Method or data member not found when i click Save button...

    untested but replace all of your form code by this
    Private Sub CBOCancel_Click()
       Unload Me
    End Sub
    Private Sub CBOClear_Click()
    
       Call UserForm_Initialize
    
    End Sub
    Private Sub CBOSave_Click()
       Dim RowCount               As Long
       Dim lCol                   As Long
    
       'Validasi Data
       If CBOJenis.Value = "" Then
          CBOJenis.SetFocus
          MsgBox "Jenisnya dipilih dong!", vbExclamation, "Data Entry Jenis"
          Exit Sub
       End If
    
       If CBOTipe.Value = "" Then
          CBOTipe.SetFocus
          MsgBox "Tipenya dipilih dong", vbExclamation, "Data Entry Tipe"
          Exit Sub
       End If
    
       If TXTDesk.Value = "" Then
          TXTDesk.SetFocus
          MsgBox "Deskripsi nya apa?", vbExclamation, "Data Entry Deskripsi"
          Exit Sub
       End If
    
       If CBOBulan.Value = "" Then
          CBOBulan.SetFocus
          MsgBox "Bulannya dipilih dong", vbExclamation, "Data Entry Bulan"
          Exit Sub
       End If
    
       If TXTJumlah.Value = "" Then
          TXTJumlah.SetFocus
          MsgBox "Jumlahnya diisi dong", vbExclamation, "Data Entry Jumlah"
          Exit Sub
       End If
    
       If Not IsNumeric(TXTJumlah.Value) = "" Then
          TXTJumlah.SetFocus
          MsgBox "Isi nya pake Angka ya!", vbExclamation, "Data Entry Jumlah"
          Exit Sub
       End If
    
       'Input data ke worksheet :p
       With Worksheets("EXPENSES")
          If Len(.Range("A3").Value) > 0 Then
             RowCount = .Range("A2").End(xlDown).Row + 1
          Else
             RowCount = 3
          End If
          .Cells(RowCount, "A").Resize(1, 3).Value = Array(CBOJenis.Value, CBOTipe.Value, TXTBOXDesk.Value)
    
          ' listindex starts at 0, output column starts in column 4/D so add index to 4 to get correct column for month
          lCol = 4 + CBOBulan.ListIndex
          .Cells(RowCount, lCol).Value = TXTBOXJumlah.Value
       End With
    
    End Sub
    Private Sub UserForm_Initialize()
       Dim ws                     As Worksheet
       
       Set ws = Worksheets("LookupLists")
    
       Me.CBOBulan.List = ws.Range("BulanList").Resize(, 2).Value
       Me.CBOJenis.List = ws.Range("JenisList").Resize(, 2).Value
       Me.CBOTipe.List = ws.Range("TipeList").Resize(, 2).Value
    
       TXTBOXDesk.Value = ""
       TXTBOXJumlah.Value = ""
       CBOJenis.SetFocus
    
    End Sub
    Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
       If CloseMode = vbFormControlMenu Then
          Cancel = True
          MsgBox "Nutup nya pencet Cancel ya!"
       End If
    End Sub

  7. #7
    Registered User
    Join Date
    12-30-2012
    Location
    Indonesia
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: Compile Error: Method or data member not found when i click Save button...

    yes JosephP. With your tweak, i finally got the ideas.... thank you very much for your time and effort....

  8. #8
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Compile Error: Method or data member not found when i click Save button...

    you're welcome :-)

+ 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] Error Msg: "Compile error: Method or data member not found" in VBA code
    By nenadmail in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-11-2012, 02:12 AM
  2. [SOLVED] Compile error: Method or data member not found.
    By ndtsteve in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-10-2012, 11:31 AM
  3. Compile Error: Method of data member not found (VBA)
    By vbatech in forum Excel Programming / VBA / Macros
    Replies: 22
    Last Post: 03-14-2012, 05:37 PM
  4. Compile Error:Method or Data Member Not Found
    By loknath in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-29-2012, 04:03 AM
  5. [SOLVED] Compile Error Method or data member not found
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-04-2005, 06:05 PM

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