Pookiemeister
Well-known Member
- Joined
- Jan 6, 2012
- Messages
- 626
- Office Version
- 365
- 2010
- Platform
- Windows
Below is the original code that I found which will find the word "Excel" in worksheet named "Source" from Range("A1:A10000") and the return the range address for the word.
I would like to modify the above code to find the product code (sPrdCde) from the Worksheet(formTitle) but instead of using Range("A1:A10000"), I would like to use the variable finalRow.
Thank You
Code:
Sub x() Dim rngX As Range
Set rngX = Worksheets("Source").Range("A1:A10000").Find(" Excel", lookat:=xlPart)
If Not rngX Is Nothing Then
MsgBox "Found at " & rngX.Address
End If
End Sub
I would like to modify the above code to find the product code (sPrdCde) from the Worksheet(formTitle) but instead of using Range("A1:A10000"), I would like to use the variable finalRow.
Code:
Sub Test()
Dim ws_count As Integer, i As Integer, finalRow As Integer, x As Integer
lDz = 0
lCs = 0
sUOM = " "
ActiveWorkbook.Worksheets(formTitle).Activate
finalRow = Cells(Rows.Count, 2).End(xlUp).Row
Call findItem
End Sub
Code:
Sub findItem()
Dim rngItem As Range
Set rngItem = Worksheets(formTitle).finalRow.Find(sPrdCde, lookat:=xlPart)
If Not rngItem Is Nothing Then
MsgBox "Found at " & rngItem.Address
End If
End Sub
Thank You