+ Reply to Thread
Results 1 to 7 of 7

excel 2007 match code problem

Hybrid View

  1. #1
    Registered User
    Join Date
    08-16-2012
    Location
    İstanbul, Turkey
    MS-Off Ver
    Excel 2007
    Posts
    4

    excel 2007 match code problem

    I am having some probles about the code below:



    Sub manueltaskekle()
    
    A = UserForm1.TextBox6.Text
    
    If Sheet1.Cells(1, 1) = "" Then
    
    Sheet1.Cells(1, 1) = A
    
        Else
    
        Dim z
        Dim x
        
        lastrow = Cells.find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
        z = Val(lastrow) + 1
    
        Dim myvalue As Long
    
    
    If myvalue = Application.Match(A, worksheet1.range("A1:A1000"), EntireColumn) Then
    
    MsgBox (A) & " Listeye ekli."
          
         
        Else
    
           Sheet1.Cells(z, 1).Value = A
             
          End If
    
    End If
        
    End Sub


    it keeps giving the " object needed" error. Is there any help available, thank you.
    Last edited by arlu1201; 08-16-2012 at 08:50 AM.

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: excel 2007 match code problem

    Welcome to the forum.

    I have added code tags to your post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    08-16-2012
    Location
    İstanbul, Turkey
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: excel 2007 match code problem

    Thank you very much, i've looked trough the form to find a simular problem like mine and i realised that the writing is different in the codes but couldn't find how to do. Thank you very much.

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: excel 2007 match code problem

    Do you get an error on this line?
    lastrow = Cells.find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    Change your code to
    Sub manueltaskekle()
    Dim z
    Dim x
    Dim myvalue As Long
    
    a = UserForm1.TextBox6.Text
    
    If Sheet1.Cells(1, 1) = "" Then
    
        Sheet1.Cells(1, 1) = a
    
    Else
        
        z = Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
        
        If myvalue = Application.Match(a, worksheet1.Range("A1:A1000"), EntireColumn) Then
    
            MsgBox (a) & " Listeye ekli."
         
        Else
    
           Sheet1.Cells(z + 1, 1).Value = a
             
        End If
    
    End If
        
    End Sub

  5. #5
    Registered User
    Join Date
    08-16-2012
    Location
    İstanbul, Turkey
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: excel 2007 match code problem

    I forget to explain the problem properly, sorry.

    i am having problems on the code below:

    If myvalue = Application.Match(A, worksheet1.range("A1:A1000"), EntireColumn) Then
    it keeps giving the object warning. I couldn't find to write a proper code for matching. I tried to write it in different formats, like worksheetfunction.match etc.

    thank you.

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: excel 2007 match code problem

    Did you try - Application.worksheetfunction.match ?

  7. #7
    Registered User
    Join Date
    08-16-2012
    Location
    İstanbul, Turkey
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: excel 2007 match code problem

    Quote Originally Posted by arlu1201 View Post
    Did you try - Application.worksheetfunction.match ?
    yes besides that i tried lots of other variations but none of them worked

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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