Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Lookup part of a cells contents

Hi,

I am trying to pull data from a list based on the results of an input
box.

The example is, I have a list off accounts "Acme1234", "AAA 3456",
"A-1 7890" etc. This list is completely variable based on account
manager.

I want to create an inputbox where I would key in "3456" and I would
get a popup messagebox that has AAA 3456 as well as several pieces of
information in that row on my spreadsheet.

Any help, as always, is appreciated.

Glen

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Lookup part of a cells contents

Here is a start.

Sub FindSomething()
dim rng as Range
dim res as String
res = InputBox("Enter string to find")
if res < "" then
set rng = cell.Find(What:=res, _
After:=Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
if not rng is nothing then
rng.Activate
end if
End if
End Sub


use rng to identify the remainder of the data you want to collect.

--
Regards,
Tom Ogilvy


"gmunro" wrote in message
oups.com...
Hi,

I am trying to pull data from a list based on the results of an input
box.

The example is, I have a list off accounts "Acme1234", "AAA 3456",
"A-1 7890" etc. This list is completely variable based on account
manager.

I want to create an inputbox where I would key in "3456" and I would
get a popup messagebox that has AAA 3456 as well as several pieces of
information in that row on my spreadsheet.

Any help, as always, is appreciated.

Glen



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default Lookup part of a cells contents

Wow, that was fast. Thank you.

I am getting a debug error based on

set rng = cell.Find(What:=res, _
After:=Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
The Cell I am looking for will always be in Column B.
Once I find it, I want to name the active cell, "MyCell" and run from
there.

Any suggestions?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Lookup part of a cells contents

You are getting an error because there was a typo - cell should have been
cells

but for column B

set rng = Columns(2).Find(What:=res, _
After:=Range("B65536"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
if not rng is nothing then
rng.Name = "MyCell"
end if

As an example, this ran fine for me:

Sub AA()
Dim rng As Range
res = "ABC"

Set rng = Columns(2).Find(What:=res, _
After:=Range("B65536"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng Is Nothing Then
rng.Name = "MyCell"
End If

End Sub

--
Regards,
Tom Ogilvy



"gmunro" wrote in message
oups.com...
Wow, that was fast. Thank you.

I am getting a debug error based on

set rng = cell.Find(What:=res, _
After:=Range("IV65536"), _
LookIn:=xlFormulas, _
LookAt:=xlPart, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
The Cell I am looking for will always be in Column B.
Once I find it, I want to name the active cell, "MyCell" and run from
there.

Any suggestions?



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional formatting using part of the cells contents Duey Excel Discussion (Misc queries) 3 April 28th 10 10:04 AM
Conditional formatting using part of the cells contents Duey Excel Discussion (Misc queries) 0 April 27th 10 06:33 PM
Looking Up Part Cell Contents Steve Excel Discussion (Misc queries) 2 April 22nd 09 05:20 PM
Extract Part of a Cells Contents Q Seanie Excel Worksheet Functions 6 November 15th 08 06:21 PM
Lookup part of a cell's contents and return value of entire cell Terri Excel Discussion (Misc queries) 2 February 21st 08 03:53 AM


All times are GMT +1. The time now is 11:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"