Results 1 to 3 of 3

Error Msg: "Compile error: Method or data member not found" in VBA code

Threaded View

  1. #1
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Error Msg: "Compile error: Method or data member not found" in VBA code

    I have this code below, but there's an error that keeps coming up that I don't know how to fix.

    Sub NewCong()
    Dim mainsh As Worksheet, targetsh As Worksheet
    Dim Stanje As Range, Ulaz As Range
    Set mainsh = Sheets("Inventory")
    Set Stanje = mainsh.Range("d7:d200")
    Set Ulaz = Stanje.Offset(, 1)
    Set targetsh = Sheets("Movement History")
    
    Dim targetX As Range
    Dim targCellX As Range
    Dim targColX As Long
    Set targetX = targetsh.Range("f1:ax1")
    Set targCellX = targetX.Find(0, , xlFormulas, xlWhole)
    targColX = targCellX.Column
    Application.EnableEvents = 0
    If targetsh.targCellX = 0 Then
    
        With targetsh
        With .Range(.Cells(7, targColX), .Cells(200, targColX))
            .Value = Stanje.Value
            .Offset(, -1).Value = Ulaz.Value
        
        End With
        End With
        Else: Exit Sub
        Next targCellX
    End If
    
    End Sub

    The error says:
    "Compile error: Method or data member not found"

    Then when I click OK, it highlights in yellow ".targCellX" in the following part of the code:

    If targetsh.targCellX = 0 Then
    Please help!
    Thannks!
    Last edited by nenadmail; 08-28-2012 at 11:54 AM.

Thread Information

Users Browsing this Thread

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

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