Dim endweek As Long
Dim lookuprange As Range
Dim resultrange As Range
Dim resultcell As Range
Dim weeknumber As Long
Dim counter As Long
Sub updategraphs()
startweek = InputBox("Specify the beginning range of the weeks you wish to graph (numbers only):", "Beginning Week Range?")
If Not IsNumeric(startweek) Then
MsgBox "Error, please input data using a number-only format.", vbOKOnly, "ERROR"
Exit Sub
End If
startweek = CLng(startweek)
endweek = startweek + 6
Set lookuprange = Worksheets("FY2023").Range("A3:BT62")
Set resultrange = Worksheets("W2W").Range("A2:A8")
For Each resultcell In resultrange
weeknumber = startweek + (resultcell.Row - resultrange.Row)
Dim foundCell As Range
Set foundCell = lookuprange.Columns(1).Find(weeknumber, LookIn:=xlValues, LookAt:=xlWhole)
If Not foundCell Is Nothing Then
resultcell.Value = foundCell.Offset(0, 6).Value
Else
resultcell.Value = "Week Not Found"
End If
Next resultcell
End Sub
Basically, I originally tried to do a vlookup function, which also had the same error. I've tried to do a count loop to fix the issue, but this has not worked either. the code works but instead of pulling the week numbers in sequential order (1, 2, 3, 4,..7) it adds four after the first one to every subsequent loop: (1, 5, 9, 13, 17.. 25) until reaching 7 loops and terminating. My main question is how do I get it to not count up like that? I'm literally just pulling year numbers from one worksheet and putting them in a location on another worksheet