Hi All
Skipvought penned me a great 5 line macro a year or so ago which has worked perfectly since but now I need to adapt it to a revamped spreadsheet. (thanks again Skip) The spreadsheet has the top 23 rows frozen for a title section and below is the scrollable area of a further 365 rows covering a full year. Each row starts with the date in col B (ie 1 Jan is in B24) and has data in the following 31 cols. The macro allows me to click a button which will bring Todays row into view just below the frozen section and works with reference to: Now().
What I would like to now do, is exactly the same task, but instead of relating my target row to todays date, I would like it to reference a date input into cell K19. My idea is to be able to shuffle the date in K19 back and forth by using a scroll bar button (which I have already successfully done) but Id also like the main grid to move at the same time in tandem with this so that the target row of data is now showing just below the frozen section. (hope that made sense, Ive rewritten it 3 times!).
Skips original macro is:
Sub GotoX()
Range("A24").Select
ActiveWindow.FreezePanes = True
x = 24 + Int(Now()) - Range("b24")
Range("b24").End(xlDown).Select
Application.Goto Reference:="R" & x & "C2"
End Sub
I’ve tried substituting Int() for K19 but it crashes in the last line of the macro and stops at 31 Dec.
Many Thanks
Shytott
Skipvought penned me a great 5 line macro a year or so ago which has worked perfectly since but now I need to adapt it to a revamped spreadsheet. (thanks again Skip) The spreadsheet has the top 23 rows frozen for a title section and below is the scrollable area of a further 365 rows covering a full year. Each row starts with the date in col B (ie 1 Jan is in B24) and has data in the following 31 cols. The macro allows me to click a button which will bring Todays row into view just below the frozen section and works with reference to: Now().
What I would like to now do, is exactly the same task, but instead of relating my target row to todays date, I would like it to reference a date input into cell K19. My idea is to be able to shuffle the date in K19 back and forth by using a scroll bar button (which I have already successfully done) but Id also like the main grid to move at the same time in tandem with this so that the target row of data is now showing just below the frozen section. (hope that made sense, Ive rewritten it 3 times!).
Skips original macro is:
Sub GotoX()
Range("A24").Select
ActiveWindow.FreezePanes = True
x = 24 + Int(Now()) - Range("b24")
Range("b24").End(xlDown).Select
Application.Goto Reference:="R" & x & "C2"
End Sub
I’ve tried substituting Int() for K19 but it crashes in the last line of the macro and stops at 31 Dec.
Many Thanks
Shytott