I am changing around a sheet where previously the cells I needed to index around where fixed at the top because each week we would insert and push down the prior weeks data. Now the new data will be added at the bottom and I'd like to use a date reference in M1 to search a date range in Column BD to begin my indexing sequence. This is all used to build Raw Json API data on a different sheet and upload events via postman to a Tsheets schedule each day.
I figured out how to get to my starting point - so what used to be "Range("C4").Select" is now
But now I have to figure out how to replace the first and second test of the existing code below
First test index's up 8 rows and right two if it used to reach row 10 in any column
Then once it works it's way across the range and gets to AY4 it ends the sequence.
How would I use offset to work with the date set by Rng
instead of:
Something like:
And replace:
with something like:
Above ends the sequence if it reaches the column 5 to the left of the Rng date
Any help would be sincerely appreciated.
I figured out how to get to my starting point - so what used to be "Range("C4").Select" is now
Code:
Dim FindString As Date
Dim Rng As Range
FindString = Sheets("Schedule").Range("M1").Value
With Sheets("Schedule").Range("BD:BD")
Set Rng = .Find(What:=FindString, _
After:=.Cells(.Cells.Count), _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not Rng Is Nothing Then
Application.Goto Rng, True
Else
MsgBox "Nothing found"
End If
End With
ActiveCell.Offset(2, -53).Select
But now I have to figure out how to replace the first and second test of the existing code below
Code:
ActiveCell.Offset(2, 0).Select
If ActiveCell.Row = 12 Then
ActiveCell.Offset(-8, 2).Select
End If
If ActiveCell.Address = "$AY$4" Then
GoTo 16
End If
First test index's up 8 rows and right two if it used to reach row 10 in any column
Then once it works it's way across the range and gets to AY4 it ends the sequence.
How would I use offset to work with the date set by Rng
instead of:
Code:
If ActiveCell.Row = 12 Then
Something like:
Code:
If Rng.Offset(rowOffset:=10) Then
And replace:
Code:
If ActiveCell.Address = "$AY$4" Then
Code:
If Rng.Offset(columnOffset:= -5) Then
Above ends the sequence if it reaches the column 5 to the left of the Rng date
Any help would be sincerely appreciated.
Last edited: