Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
van van is offline
external usenet poster
 
Posts: 3
Default Match Inputbox Value on Values in Column

I have an inputbox function, which requests a particular number (00 to 012)
from the user. I also have a column in excel which contains random numbers
in this range.

When the user enters a number I would like to be able to match this input to
the column of numbers, and extract those which match the input. Any ideas ?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Match Inputbox Value on Values in Column

00 is really a number. If you enter 00 and treat it as a number, then it
would be 0. So does your column Store numbers with formatting to show a
leading zero, or does you column contain Text.

one way

Sub FindCells()
Dim ans as String, cell as Range
Dim rng as Range
ans = InputBox("Enter value")
for each cell in Range("A1",Cells(rows.count,1).End(xlup))
if cell.Text = ans then
if rng is nothing then
set rng = cell
else
set rng = union(rng,cell)
end if
end if
Next
if not rng is nothing
rng.Select
End if
End Sub




--
Regards,
Tom Ogilvy

"van" wrote in message
...
I have an inputbox function, which requests a particular number (00 to

012)
from the user. I also have a column in excel which contains random

numbers
in this range.

When the user enters a number I would like to be able to match this input

to
the column of numbers, and extract those which match the input. Any ideas

?




  #3   Report Post  
Posted to microsoft.public.excel.programming
van van is offline
external usenet poster
 
Posts: 3
Default Match Inputbox Value on Values in Column

Thanx Tom

The column stores numbers with a leading zero.
The code attached does not match up the list of numbers and copy them to a
separate location. Any ideas?

Thx

"Tom Ogilvy" wrote in message
...
00 is really a number. If you enter 00 and treat it as a number, then it
would be 0. So does your column Store numbers with formatting to show a
leading zero, or does you column contain Text.

one way

Sub FindCells()
Dim ans as String, cell as Range
Dim rng as Range
ans = InputBox("Enter value")
for each cell in Range("A1",Cells(rows.count,1).End(xlup))
if cell.Text = ans then
if rng is nothing then
set rng = cell
else
set rng = union(rng,cell)
end if
end if
Next
if not rng is nothing
rng.Select
End if
End Sub




--
Regards,
Tom Ogilvy

"van" wrote in message
...
I have an inputbox function, which requests a particular number (00 to

012)
from the user. I also have a column in excel which contains random

numbers
in this range.

When the user enters a number I would like to be able to match this

input
to
the column of numbers, and extract those which match the input. Any

ideas
?






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Match Inputbox Value on Values in Column

That code is pretty basic. If it doesn't work, it could be because you
haven't accurately described what is in the cell, what you enter has no
match, it is looking at the wrong location - any number of things. Assume
you have made modifications so it matches your situation. but as I said,
it is very simple and basic and slow - should work if a match can be made.

--
Regards,
Tom Ogilvy

"van" wrote in message
...
Thanx Tom

The column stores numbers with a leading zero.
The code attached does not match up the list of numbers and copy them to a
separate location. Any ideas?

Thx

"Tom Ogilvy" wrote in message
...
00 is really a number. If you enter 00 and treat it as a number, then

it
would be 0. So does your column Store numbers with formatting to show a
leading zero, or does you column contain Text.

one way

Sub FindCells()
Dim ans as String, cell as Range
Dim rng as Range
ans = InputBox("Enter value")
for each cell in Range("A1",Cells(rows.count,1).End(xlup))
if cell.Text = ans then
if rng is nothing then
set rng = cell
else
set rng = union(rng,cell)
end if
end if
Next
if not rng is nothing
rng.Select
End if
End Sub




--
Regards,
Tom Ogilvy

"van" wrote in message
...
I have an inputbox function, which requests a particular number (00 to

012)
from the user. I also have a column in excel which contains random

numbers
in this range.

When the user enters a number I would like to be able to match this

input
to
the column of numbers, and extract those which match the input. Any

ideas
?








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
Match values in more than one column Richhall[_2_] Excel Worksheet Functions 6 January 6th 10 11:13 PM
If two criteria match then sum matching values in another column Diddy Excel Worksheet Functions 5 February 25th 09 06:03 PM
match values in two column and return value in PW Excel Worksheet Functions 3 July 30th 08 06:52 PM
MATCH A NUMBER AS THE SUM OF VALUES IN A COLUMN Mau Excel Worksheet Functions 1 February 7th 07 12:09 PM
How to match values in one column to values in another? trib Excel Worksheet Functions 3 July 25th 06 08:30 AM


All times are GMT +1. The time now is 12:19 AM.

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

About Us

"It's about Microsoft Excel"