+ Reply to Thread
Results 1 to 13 of 13

Prompt User to enter value and use value to filter on separate sheet

  1. #1
    Registered User
    Join Date
    05-12-2017
    Location
    Canada
    MS-Off Ver
    Mac - 15.27
    Posts
    12

    Prompt User to enter value and use value to filter on separate sheet

    Hello Excel Forum,

    First off, I'm new here and have scoured the internet for the last couple days but can't seem to find the answer for my question - please bare with me.
    I have a two sheet workbook and i need a macro that does one of the following (I'm not sure which is easier to write, so I'm indifferent).

    (1) On sheet 1, prompt the user to enter a value that will be used to filter the data on sheet 2
    (2) On sheet 1, have a dropdown menu of possible values and use that value to filter data on sheet 2.


    I hope this post meets the forums rules, I couldn't find a FAQ on the Excel Programming/VBA/Macros page.


    Cheers
    Last edited by VBA_Newguy; 05-12-2017 at 06:56 PM.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Prompt User to enter value and use value to filter on separate sheet

    Hi Newguy & Welcome to the Forum,

    When you say prompt the user, how will sheet 2 no what column to filter on?

    Can you mock up an example worksheet with a sample of what you have and what you desire?

    Either option is possible I suppose, just need to understand more on how the user is supposed to tell sheet 2 the column to act on.
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    05-12-2017
    Location
    Canada
    MS-Off Ver
    Mac - 15.27
    Posts
    12

    Re: Prompt User to enter value and use value to filter on separate sheet

    Hi Jeff,

    the user input will filter Column A on sheet 2.

    I can't attach the actual file. However, i have a very basic mock up that i don't know how to attach or display on here...
    Last edited by jeffreybrown; 05-12-2017 at 07:12 PM. Reason: removed full quotes which are not necessary.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Prompt User to enter value and use value to filter on separate sheet

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  5. #5
    Registered User
    Join Date
    05-12-2017
    Location
    Canada
    MS-Off Ver
    Mac - 15.27
    Posts
    12

    Re: Prompt User to enter value and use value to filter on separate sheet

    Here you go Jeff, i appreciate the quick reply.

    Now that i mocked this up very simply, it seems so much more simple but still over my head.
    Attached Files Attached Files
    Last edited by jeffreybrown; 05-12-2017 at 07:18 PM. Reason: Removed full quote

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Prompt User to enter value and use value to filter on separate sheet

    Before I cobbled something together, got to ask!

    If the user is going to select from the dropdown box for Region, why can't they just filter straight to the data sheet?

  7. #7
    Registered User
    Join Date
    05-12-2017
    Location
    Canada
    MS-Off Ver
    Mac - 15.27
    Posts
    12

    Re: Prompt User to enter value and use value to filter on separate sheet

    This will be part of a larger script, but this is only a portion of the problem thus far!
    Last edited by jeffreybrown; 05-12-2017 at 07:28 PM.

  8. #8
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Prompt User to enter value and use value to filter on separate sheet

    Please do not keep using the full quotes. They are not necessary and they just cause clutter.

  9. #9
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Prompt User to enter value and use value to filter on separate sheet

    Give this a try
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    05-12-2017
    Location
    Canada
    MS-Off Ver
    Mac - 15.27
    Posts
    12

    Re: Prompt User to enter value and use value to filter on separate sheet

    That works very well, thank you.


    Is is possible to display all regions (1 - 7) as one of the drop down options?

  11. #11
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Prompt User to enter value and use value to filter on separate sheet

    Did you look at B2? There already is a dropdown with the 1-7 choices.

  12. #12
    Registered User
    Join Date
    05-12-2017
    Location
    Canada
    MS-Off Ver
    Mac - 15.27
    Posts
    12

    Re: Prompt User to enter value and use value to filter on separate sheet

    Hi Jeff,

    I apologize for the late response but i was waiting to run the sub at work before i got back to you.

    The sub worked fine at home, but One problem im experiencing now that im at work is that the sub isnt appearing when i go to 'assign' the macro to a button. More over, the sub wont run (or even appear) inside the VBA editor.

    When i comment out the "option explicit " and the "(ByVal Target As Range") it appears on the list (albeit not working - obviously).

    Is there some type of library necessary to run this script?

    I appreciate your efforts.
    Last edited by VBA_Newguy; 05-15-2017 at 12:43 PM.

  13. #13
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Prompt User to enter value and use value to filter on separate sheet

    This macro is a worksheet level macro and therefore does not show up in the macro name dialogue box (Alt + F8).

    This macro will fire once you select from the data validation in B2.

    If you want to run this macro thru the press of a button...

    Copy the macro below...

    Please Login or Register  to view this content.

    Paste code in a Normal module
    • Where to paste code
    • Alt + F11 >> opens the Visual Basic Editor (VBE)
    • Ctrl + R >>opens the Project Explorer (if not already open on left side of screen
    • Insert menu >> Module or Alt + I, M >> activates the Insert menu and inserts a Standard Module
    • Paste code >> Ctrl + V (right side of screen)
    • Alt + Q >> exits VBE and returns to Excel
    • Back in Excel >> Alt + F8 >> Macro Dialog Box >> Highlight macro >> Run

    After you've tested it this way, now place a button on the sheet via the developer tab >> Controls >> Insert >> Button

    Now attach the code to this button

+ 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. Prompt User to Enter File Name
    By CC268 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2017, 02:02 PM
  2. Prompt user to enter date, then validate date, then continue with macro
    By rgiglio7489 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-18-2014, 04:54 PM
  3. [SOLVED] Prompt to choose from separate book and sheet from which to copy...
    By macrorookie in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-01-2014, 06:10 AM
  4. Prompt user to enter cell value to save file name (with cell value)
    By stama100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-11-2013, 10:33 AM
  5. Messagebox prompt then allow user to enter data before continuing code execution
    By wazimu13 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-13-2013, 09:17 AM
  6. [SOLVED] Prompt user when unprotecting sheet
    By abchak1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-15-2013, 02:47 PM
  7. Prompt user to enter value for descriptive statistic calculation
    By Beginner Level in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-24-2012, 10:45 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