Hi all,
I'd appreciate some help on some code i'm trying to write as a beginner. I have two sets of rows of interest: (i) 6-15 and (ii) 18-27. Each of these blocks contain data for the next 10 years across the columns (hence 10 rows each). I want the user to be able to choose how many years they want to analyse (up to the mentioned maximum 10). I would like to write a VBA macro that hides those rows which aren't of use in each block. So for example, if the user inputs 4 in cell C2, I would like excel to hide rows 10-15 and 22-27 (keeping rows 6-9 and 18-21 as they are) so that only 4 rows are showing in each block. I know how to write code to hide specific rows -> [Worksheets("xxx").Range("xx:xx").EntireRow.Hidden = True] but I don't know how to hide rows dependent on a user input.
Thanks!
Bookmarks