foundRng not returning correct value to search for

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
657
Office Version
  1. 2019
Platform
  1. Windows
Hello,
Within a macro, I use the following code:

SQL:
Dim Rng As Range
    Set Rng = Worksheets("Weekly Picks").Range("B1")

    Sheets("Weeks").Select
    Set foundRng = Range("2:2").Find(Rng) 'using Row 2 to find Rng
   'MsgBox (foundRng)
   
    If Not (foundRng Is Nothing) Then
        foundRng.Select
        ActiveCell.Offset(1, 0).Select
        Range(Selection, Selection.End(xlDown)).Copy
        Sheets("Weekly Picks").Select
        Range("A4").Select
        ActiveSheet.Paste
    Else
        
    End If

Rng is used multiple times in the macro, but stays the same value.
The Rng = 1 but its going to J:J, representing 10. I want it to return 1, according to the cell value. The Rng will range from 1-18, depending on the cell value.
Here is the range of data im using:-
NFL.xlsm
ABCDEFGHIJKLMNOPQR
1WEEKWEEKWEEKWEEKWEEKWEEKWEEKWEEKWEEKWEEKWEEKWEEKWEEKWEEKWEEKWEEKWEEKWEEK
2123456789101112131415161718
Weeks
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
How about
VBA Code:
Set foundRng = Range("2:2").Find(Rng, , , xlWhole, , , , , False)
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top