Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Hello I am new to Excel VBA and think I have thrown myself into the deep end
by trying to produce an advanced spreadsheet. What I am trying to do is have a button on my spreadsheet that when clicked opens up an Input Box, the user can input some data and then it searches a column for the matching input. For Example Input Box "Hello" I would like it to then search column A1:A20 for the Word Hello. Once found just leave the cell selected and a message box saying the word has been found. If anyone could do this for me I would be very greatful I have tried now for 2 days and finding it really tough. Thanks for the help |
#2
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Chris,
Try some code like the following: Dim FoundCell As Range Dim WhatToFind As String WhatToFind = InputBox("Find What?") If WhatToFind = "" Then Exit Sub End If Set FoundCell = Range("A1:A20").Find(what:=WhatToFind, _ LookIn:=xlValues, lookat:=xlWhole) If Not FoundCell Is Nothing Then FoundCell.Select MsgBox WhatToFind & " found at " & FoundCell.Address End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Chris" wrote in message ... Hello I am new to Excel VBA and think I have thrown myself into the deep end by trying to produce an advanced spreadsheet. What I am trying to do is have a button on my spreadsheet that when clicked opens up an Input Box, the user can input some data and then it searches a column for the matching input. For Example Input Box "Hello" I would like it to then search column A1:A20 for the Word Hello. Once found just leave the cell selected and a message box saying the word has been found. If anyone could do this for me I would be very greatful I have tried now for 2 days and finding it really tough. Thanks for the help |
#3
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Thanks Chip however I found a solution and modified it to what I wanted its
pretty cool. Seperated into two different modules. Thanks for your time and the reply. Chris "Chip Pearson" wrote: Chris, Try some code like the following: Dim FoundCell As Range Dim WhatToFind As String WhatToFind = InputBox("Find What?") If WhatToFind = "" Then Exit Sub End If Set FoundCell = Range("A1:A20").Find(what:=WhatToFind, _ LookIn:=xlValues, lookat:=xlWhole) If Not FoundCell Is Nothing Then FoundCell.Select MsgBox WhatToFind & " found at " & FoundCell.Address End If -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Chris" wrote in message ... Hello I am new to Excel VBA and think I have thrown myself into the deep end by trying to produce an advanced spreadsheet. What I am trying to do is have a button on my spreadsheet that when clicked opens up an Input Box, the user can input some data and then it searches a column for the matching input. For Example Input Box "Hello" I would like it to then search column A1:A20 for the Word Hello. Once found just leave the cell selected and a message box saying the word has been found. If anyone could do this for me I would be very greatful I have tried now for 2 days and finding it really tough. Thanks for the help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel: How to choose data on two separate rows in the same column | Excel Worksheet Functions | |||
ranking query | Excel Discussion (Misc queries) | |||
Return SEARCHED Column Number of Numeric Label and Value | Excel Worksheet Functions | |||
Searching for partial data in a column | Excel Discussion (Misc queries) | |||
Sort pages? | Excel Discussion (Misc queries) |