Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Macro to ask for a item# and then show all details for that item

i have details for parts in excel. Like to have a macro that will ask the
user for a item number and shaw all details for that item
example
Item# purchase sold date region
a0012 1200 400 12/12/09 Ont
b1115 500 200 12/01/09 Ont
a0012 300 50 12/05/09 Aberta
a0012 400 25 12/08/09 Ont

Thanks for any help
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,346
Default Macro to ask for a item# and then show all details for that item

Hi,

Might consider using an autofilter instead of a macro - Data, Filter, Auto
Filter. Then open the filter in the Item# column and pick any number.

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Durai" wrote:

i have details for parts in excel. Like to have a macro that will ask the
user for a item number and shaw all details for that item
example
Item# purchase sold date region
a0012 1200 400 12/12/09 Ont
b1115 500 200 12/01/09 Ont
a0012 300 50 12/05/09 Aberta
a0012 400 25 12/08/09 Ont

Thanks for any help

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Macro to ask for a item# and then show all details for that item

hi
i think a small macro with a inputbox and filter might be what you want...
Sub AskAndFilter()
Dim c As String
Dim r As Range
Set r = Range("A1:G1000")
c = InputBox("Enter Item Number")
r.AutoFilter Field:=1, Criteria1:=c
End Sub

adjust range to fist your data.
you can run it from a command button on the sheet.

new to macro?? see this site....
http://www.mvps.org/dmcritchie/excel/getstarted.htm

regards
FSt1

"Durai" wrote:

i have details for parts in excel. Like to have a macro that will ask the
user for a item number and shaw all details for that item
example
Item# purchase sold date region
a0012 1200 400 12/12/09 Ont
b1115 500 200 12/01/09 Ont
a0012 300 50 12/05/09 Aberta
a0012 400 25 12/08/09 Ont

Thanks for any help

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Macro to ask for a item# and then show all details for that it

Works very well. i clicked "yes'.
if I like to use either " item number' or "region" or "sold', then how can I
change the input box to ask accordingly. Please help.
Thanks

"FSt1" wrote:

hi
i think a small macro with a inputbox and filter might be what you want...
Sub AskAndFilter()
Dim c As String
Dim r As Range
Set r = Range("A1:G1000")
c = InputBox("Enter Item Number")
r.AutoFilter Field:=1, Criteria1:=c
End Sub

adjust range to fist your data.
you can run it from a command button on the sheet.

new to macro?? see this site....
http://www.mvps.org/dmcritchie/excel/getstarted.htm

regards
FSt1

"Durai" wrote:

i have details for parts in excel. Like to have a macro that will ask the
user for a item number and shaw all details for that item
example
Item# purchase sold date region
a0012 1200 400 12/12/09 Ont
b1115 500 200 12/01/09 Ont
a0012 300 50 12/05/09 Aberta
a0012 400 25 12/08/09 Ont

Thanks for any help

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Macro to ask for a item# and then show all details for that it

One method...........

Sub AskAndFilter_Select()
Dim c As String
Dim mycol As Range
Dim col As String
Dim d As Integer
Dim r As Range
Set r = Range("A1:G1000")
Set mycol = Application.InputBox(prompt:="Select a Column", Type:=8)
col = Left(mycol.Address, 2)
d = Columns(col).Column
c = InputBox("Enter Criteria")
r.AutoFilter Field:=d, Criteria1:=c
End Sub

Another..........

Sub AskAndFilter_Letter()
Dim c As String
Dim mycol As String
Dim r As Range
Set r = Range("A1:G1000")
mycol = InputBox("Type a column letter")
d = Columns(mycol).Column
c = InputBox("Enter Criteria")
r.AutoFilter Field:=d, Criteria1:=c
End Sub


Gord Dibben MS Excel MVP




On Thu, 3 Dec 2009 18:32:01 -0800, Durai
wrote:

Works very well. i clicked "yes'.
if I like to use either " item number' or "region" or "sold', then how can I
change the input box to ask accordingly. Please help.
Thanks

"FSt1" wrote:

hi
i think a small macro with a inputbox and filter might be what you want...
Sub AskAndFilter()
Dim c As String
Dim r As Range
Set r = Range("A1:G1000")
c = InputBox("Enter Item Number")
r.AutoFilter Field:=1, Criteria1:=c
End Sub

adjust range to fist your data.
you can run it from a command button on the sheet.

new to macro?? see this site....
http://www.mvps.org/dmcritchie/excel/getstarted.htm

regards
FSt1

"Durai" wrote:

i have details for parts in excel. Like to have a macro that will ask the
user for a item number and shaw all details for that item
example
Item# purchase sold date region
a0012 1200 400 12/12/09 Ont
b1115 500 200 12/01/09 Ont
a0012 300 50 12/05/09 Aberta
a0012 400 25 12/08/09 Ont

Thanks for any help




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Macro to ask for a item# and then show all details for that it

Thanks a lot . Works well

"Gord Dibben" wrote:

One method...........

Sub AskAndFilter_Select()
Dim c As String
Dim mycol As Range
Dim col As String
Dim d As Integer
Dim r As Range
Set r = Range("A1:G1000")
Set mycol = Application.InputBox(prompt:="Select a Column", Type:=8)
col = Left(mycol.Address, 2)
d = Columns(col).Column
c = InputBox("Enter Criteria")
r.AutoFilter Field:=d, Criteria1:=c
End Sub

Another..........

Sub AskAndFilter_Letter()
Dim c As String
Dim mycol As String
Dim r As Range
Set r = Range("A1:G1000")
mycol = InputBox("Type a column letter")
d = Columns(mycol).Column
c = InputBox("Enter Criteria")
r.AutoFilter Field:=d, Criteria1:=c
End Sub


Gord Dibben MS Excel MVP




On Thu, 3 Dec 2009 18:32:01 -0800, Durai
wrote:

Works very well. i clicked "yes'.
if I like to use either " item number' or "region" or "sold', then how can I
change the input box to ask accordingly. Please help.
Thanks

"FSt1" wrote:

hi
i think a small macro with a inputbox and filter might be what you want...
Sub AskAndFilter()
Dim c As String
Dim r As Range
Set r = Range("A1:G1000")
c = InputBox("Enter Item Number")
r.AutoFilter Field:=1, Criteria1:=c
End Sub

adjust range to fist your data.
you can run it from a command button on the sheet.

new to macro?? see this site....
http://www.mvps.org/dmcritchie/excel/getstarted.htm

regards
FSt1

"Durai" wrote:

i have details for parts in excel. Like to have a macro that will ask the
user for a item number and shaw all details for that item
example
Item# purchase sold date region
a0012 1200 400 12/12/09 Ont
b1115 500 200 12/01/09 Ont
a0012 300 50 12/05/09 Aberta
a0012 400 25 12/08/09 Ont

Thanks for any help


.

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
To find rate of each item from item.xls and to copy price.xls pol Excel Discussion (Misc queries) 7 July 16th 09 12:49 AM
How to set up pivot to show name of series item in bar chart Lin, PMP, NJ Charts and Charting in Excel 0 November 28th 07 04:14 PM
Item numbers result in item description in next field in Excel Cheryl MM Excel Worksheet Functions 1 February 20th 07 03:51 PM
select from item and show data filtred... sal21 Excel Discussion (Misc queries) 0 December 2nd 06 02:03 PM
Selecting an Item from a List and getting a different item to pop. Matt Excel Worksheet Functions 1 December 7th 04 02:37 PM


All times are GMT +1. The time now is 11:54 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"