Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 563
- Office Version
- 365
- 2010
- Platform
- Windows
Code:
Sub Test()
Dim ws_count As Integer, i As Integer, finalRow As Integer, x As Integer
Dim Rng As Range
lDz = 0
lCs = 0
sUOM = " "
With ActiveWorkbook.Worksheets(formTitle)
Set Rng = .Range("B2", .Range("B" & Rows.Count).End(xlUp))
End With
Call findItem(Rng, sPrdCde)
lDz = Cells(rngItem.Address, 4)
lCs = Cells(rngItem.Address, 5)
sUOM = Cells(rngItem.Address, 6)
If lDz = 0 Or lCs = 0 Or sUOM = "" Then
Call ErrorTrap
End If
Chattfrm.Show
End Sub
Code:
Function findItem(Rng As Range, sPrdCde As String) As String
Set rngItem = Rng.Find(sPrdCde, lookat:=xlPart)
If Not rngItem Is Nothing Then
MsgBox "Found at " & rngItem.Address
End If
End Function
The problem I am having is that variables lDz, lCs, sUOM don't return any values even though there are values there to be retrieved. Would the problem that I am having have anything to do with the fact that rngItem.Address returns an absolute cell reference?
Code:
lDz = Cells(rngItem.Address, 4) lCs = Cells(rngItem.Address, 5)
sUOM = Cells(rngItem.Address, 6)
Thank You