+ Reply to Thread
Results 1 to 4 of 4

Macro to Select cell from Input Box

  1. #1
    Registered User
    Join Date
    09-12-2019
    Location
    Malta
    MS-Off Ver
    Office 365 ProPlus Version 1904
    Posts
    6

    Macro to Select cell from Input Box

    Hi!

    I am using the following macro to highlight cells with matching data. User needs to input a provider name in an input box and this information is then matched to a sheet named 'Deposit Methods'

    Sub Search()

    ProviderAccountName = InputBox("Enter the Provider Account Name you want to search for")

    Dim myrange As Range

    Set myrange = ThisWorkbook.Worksheets("Deposit Methods").UsedRange

    For Each cell In myrange.Cells

    If cell.Value = ProviderAccountName Then

    cell.Interior.Color = 255

    End If

    Next

    End Sub


    Macro works OK however I have the following issues:

    - Is it possible to tweak the macro to have it also select the cell that is being highlighted on the sheet 'Deposit Methods' instead of having to scroll down (look for it) manually? On this sheet there can only be one match at a time with the Input Box
    - If I press cancel on the Input Box (or X to close) the macro is highlighting the entire background on the 'Deposit Method' sheet in the same colour (255). Any way to avoid this when pressing cancel or close on the Input Box?

    Much appreciated!

    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    12-14-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    439

    Re: Macro to Select cell from Input Box

    Try this code
    Please use CODE TAG for code.
    Please Login or Register  to view this content.
    Last edited by huuthang_bd; 09-12-2019 at 05:45 AM.

  3. #3
    Registered User
    Join Date
    09-12-2019
    Location
    Malta
    MS-Off Ver
    Office 365 ProPlus Version 1904
    Posts
    6

    Re: Macro to Select cell from Input Box

    Amazing - worked like a charm!

    Thank you so much and my apologies for not posting correctly.

    Chris

  4. #4
    Valued Forum Contributor
    Join Date
    12-14-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2007
    Posts
    439

    Re: Macro to Select cell from Input Box

    You are welcome. Please make this thread is solved.

+ 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. Input box to select the column impacted by a macro
    By coryjacques in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-16-2018, 11:07 PM
  2. Macro: number of rows to select changes based on input
    By Sandraa4218 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-19-2017, 05:26 AM
  3. Replies: 1
    Last Post: 04-20-2016, 02:16 PM
  4. Making an macro/button to select selected cell to input text/fill colour
    By liqt in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-15-2015, 01:51 PM
  5. [SOLVED] Macro to select data via input box's
    By Justair07 in forum Excel Programming / VBA / Macros
    Replies: 23
    Last Post: 09-19-2013, 10:12 AM
  6. Use input box result to select a cell
    By Hobbage in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-23-2013, 12:20 PM
  7. [SOLVED] input date column A, increment B, select blank cell in D and input time. in a macro
    By jeffstu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-19-2012, 11:19 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