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!
Bookmarks