+ Reply to Thread
Results 1 to 3 of 3

Hide number of rows based on user input

  1. #1
    Registered User
    Join Date
    10-31-2019
    Location
    UK
    MS-Off Ver
    365
    Posts
    9

    Hide number of rows based on user input

    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!

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: Hide number of rows based on user input

    Something like this:

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Registered User
    Join Date
    10-31-2019
    Location
    UK
    MS-Off Ver
    365
    Posts
    9

    Re: Hide number of rows based on user input

    Quote Originally Posted by WideBoyDixon View Post
    Something like this:

    Please Login or Register  to view this content.
    WBD
    Thank you I will give this a go.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Hide All Rows and Display only one row based on User input
    By neetag in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 11-23-2020, 08:44 PM
  2. [SOLVED] VBA code to hide sheets based on user input
    By Vivek2705 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-17-2019, 09:32 AM
  3. how to copy number of rows based on user input
    By prabhuduraraj09 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-14-2019, 03:30 PM
  4. Replies: 15
    Last Post: 07-11-2017, 10:55 AM
  5. Data Input Form with number of line items based on user input
    By j_gideon in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2013, 02:54 PM
  6. [SOLVED]Hide Rows and Columns Based on User Input
    By thesteve in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-31-2013, 01:32 PM
  7. Using text box input to lookup number and replace based on user input into new column
    By harl3y412 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-28-2011, 03:15 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1