Trouble setting range

Noz2k

Well-known Member
Joined
Mar 15, 2011
Messages
693
So I have a bit of code which I want to set the range to loop through and post back all instances where it meets a certain criteria.

This works fine when my code is like

Code:
With ws1.Range("M3:M" & lngLastRow)
 Set rngresolved = .Find("Yes", LookIn:=xlValues)
    If Not rngresolved Is Nothing Then
        rngresolved1 = rngresolved.Address
 
            Do
                If Sheets("MainMenu").cboShift.Value = "AM" Then
                    If Format(CDate(rngresolved.Offset(, 1)), "dd/mm/yyyy") = Format(Date, "dd/mm/yyyy") _
                    And Format(rngresolved.Offset(, 2), "hh:mm") >= Format("02:00", "hh:mm") _
                    And Format(rngresolved.Offset(, 2), "hh:mm") < Format("16:00", "hh:mm") Then
 
'Lots of specification for where everything posts to
 
 
Set rngresolved = .FindNext(rngresolved)
Loop While Not rngresolved Is Nothing And rngresolved.Address <> rngresolved1
End With

However I want to do the same thing but irregardless of the value in M (so I want the range to start as M3, and then loop through until the value is empty)

how do I set it as that?

I've tried rngresolved = .range("M3") but the code falls down at the .findnext part (obviously), I tried changing that to rngresolved = rngresolved.Offset(1, 0) but no success.
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,224,507
Messages
6,179,181
Members
452,893
Latest member
denay

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