+ Reply to Thread
Results 1 to 4 of 4

User inputs number on sheet 1 and multiple cells (from sheet 2) are shown on sheet 3

Hybrid View

  1. #1
    Registered User
    Join Date
    03-29-2014
    Location
    Alabama
    MS-Off Ver
    Excel 2010
    Posts
    19

    User inputs number on sheet 1 and multiple cells (from sheet 2) are shown on sheet 3

    I would like to enter a number on sheet 1 (A1) and have the data from sheet 2 displayed on sheet 3.

    For example. If I enter a 1 in cell A1 on sheet 1. I would like only cell A1 of sheet 2 appear on sheet three.

    If I enter a 2 on sheet 1 (A1) I would like cells A1 and A2 appear on sheet three (without the need for filling down).

    If I enter a 3 on sheet 1 (A1) I would like cells A1-A3 appear on sheet three without having to manually fill down on sheet 3....and so on.

    I have attached a spreadsheet as an example. I have no problem getting the first row to appear on sheet 3 using an IF statement but I'm not sure how to have multiple rows appear with multiple if statements and without having to fill down.

    Thanks.
    Attached Files Attached Files

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: User inputs number on sheet 1 and multiple cells (from sheet 2) are shown on sheet 3

    Try this...
    =INDEX(Sheet2!$A$1:$A$4,Sheet1!A1)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,788

    Re: User inputs number on sheet 1 and multiple cells (from sheet 2) are shown on sheet 3

    Copy the below code and do right click on SHEET1 sheet tab and select view code and paste it.

    Close the VBA window (Alt+Q to close VBA window) and return to that sheet and check.

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    If Target.Address = "$A$1" Then
        If IsNumeric(Target.Value) Then
            With Sheets("Sheet3")
                If Target.Value Then
                    Application.ScreenUpdating = False
                    .Range("A:A").ClearContents
                    Sheets("Sheet2").Range("A1:A" & Target.Value).Copy .Range("A1")
                    Application.ScreenUpdating = True
                End If
            End With
        End If
    End If
    
    End Sub


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  4. #4
    Registered User
    Join Date
    03-29-2014
    Location
    Alabama
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: User inputs number on sheet 1 and multiple cells (from sheet 2) are shown on sheet 3

    Thanks FDibbins for you response but sixthsence's solution did the trick! Wow, that was fast. Thanks so much.

+ 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. Replies: 2
    Last Post: 06-11-2014, 11:14 AM
  2. Replies: 5
    Last Post: 09-08-2013, 10:09 AM
  3. [SOLVED] Worksheet Activate when user selects sheet NOT when sheet is created from a template sheet
    By y0rk1e72 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-26-2012, 02:47 PM
  4. Replies: 3
    Last Post: 05-03-2012, 11:01 AM
  5. Cell Total shown Sheet to Sheet
    By macgilgamesh in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 10-08-2005, 10:06 AM

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