foundRng not returning correct value to search for

gtd526

Well-known Member
Joined
Jul 30, 2013
Messages
660
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

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
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,634
Messages
6,125,938
Members
449,275
Latest member
jacob_mcbride

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