Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / New Users / November 2007

Tip: Looking for answers? Try searching our database.

New user needs help

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BB - 27 Nov 2007 03:06 GMT
Hello

I have a spreadsheet of a rather large stocklist.  I use this to check off
the price charged on the invoice when we receive the goods, against the
quoted buy price in the spreadsheet. Column A3 - A8000 (ish) contains a
product code; B3 = description; C3 = buy price; D3 = sell price; E3 = Profit
margin, etc.

What I would like to do to make this job of checking the prices off more
efficient, is to type in the product code of the item i am checking in say,
A2, and have the corresponding information appear.  Is this possible???  

Any help would be greatly appreciated.  Thank you
OssieMac - 27 Nov 2007 07:18 GMT
Hi,

The following macro will find the value that you enter in a specific cell. I
have used cell F1 in the code but you can change that to any other cell not
in use but you will need to edit the macro accordingly. Each time you enter a
value in the cell, the row with the value will be selected (Highlighted)
which should make it easy to read the data.

After you paste the macro into your workbook, you will see some lines in
green. These are comment (information) lines and do not form part of the
code. You may need to do some simple editing of the code as per these
instructions.

To copy the macro into your workbook:-

Ensure that you have macros enabled with notification. (See options)

Right click on the worksheet name tab where you have your data. Then Select
View code which will open the VBA editor in the worksheet area.

Copy the macro below and then paste it into the large white area of the VBA
editor.

Alt/F11 will toggle between the VBA editor and the worksheet.

Edit the code if required so that the column with your codes is correct and
the cell where you want to enter the data is correct.

to close the VBA editor, Click on the X with the red background top right of
screen.

Type a code into the cell where you want to enter the data. If not found,
you will get a message accordingly otherwise the row will be highlighted.

As a tip: If you freeze the panes below the column headers and use a cell
within the frozen panes area for the value to find, you will never have to
scroll back to the row to enter a new value.

Feel free to get back to me if you have any problems or want some
alterations to the macro.

Signature

Regards,

OssieMac

> Hello
>
[quoted text clipped - 9 lines]
>
> Any help would be greatly appreciated.  Thank you
BB - 27 Nov 2007 09:31 GMT
Hi OssieMac,

Thanks so much for your reply, I very much appreciate it.  

I've had a bit of a play, and can see from your instructions what I would
need to do, however, I couldn't find your macro?

> Hi,
>
[quoted text clipped - 50 lines]
> >
> > Any help would be greatly appreciated.  Thank you
OssieMac - 27 Nov 2007 21:10 GMT
My apologies for not including the macro. Must have been a 'Seniors Moment'.
It looks like you have your answer now and it is probably a better answer but
as you said that you did have a play with it, I thought that you might like
to see the macro anyway so here it is:-

Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngToSearch As Range
Dim strToFind As String
Dim foundcell As Range
Dim rngToMatch As Range

'Edit F1 to match the cell where you
'want to enter the code to find
Set rngToMatch = Range("F1")

If Target.Address = rngToMatch.Address Then
   With ActiveSheet
       'Edit "A:A" to match your column
       'to search for product code
       Set rngToSearch = Columns("A:A")
   End With
   
   strToFind = rngToMatch.Value
   Set foundcell = rngToSearch.Find(What:=strToFind, _
       LookIn:=xlFormulas, _
       LookAt:=xlWhole, _
       SearchOrder:=xlByColumns, _
       SearchDirection:=xlNext, _
       MatchCase:=False, _
       SearchFormat:=False)
   
   If Not foundcell Is Nothing Then
       foundcell.EntireRow.Select
   Else
       MsgBox strToFind & " not found"
   End If

End If
End Sub

Signature

Regards,

OssieMac

> Hi OssieMac,
>
[quoted text clipped - 57 lines]
> > >
> > > Any help would be greatly appreciated.  Thank you
BB - 27 Nov 2007 22:54 GMT
Thank you OssieMac!  I've been checking back in the hopes that you may have
responded, as you are right, I would like to see how the macro would work.  
I appreciate your help.  Glad you've recovered from your "Seniors Moment"....

> My apologies for not including the macro. Must have been a 'Seniors Moment'.
> It looks like you have your answer now and it is probably a better answer but
[quoted text clipped - 97 lines]
> > > >
> > > > Any help would be greatly appreciated.  Thank you
Sandy Mann - 27 Nov 2007 10:00 GMT
I can't see OssieMac's code either but unless I am reading you wrong you
don't need VBA.

In B2 enter:

=IF($A$2="","",VLOOKUP($A2,$A3:$E10000,COLUMNS($A$2:B2),FALSE))

and drag across to E2 using the fill handle.

If your data is wider than Column E then expand that range in the formula.

Now hen you enter a Product Code in A2 the other cells will automatucall
fill in with the other data.

Signature

HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

sandymann2@mailinator.com
Replace @mailinator.com with @tiscali.co.uk

> Hello
>
[quoted text clipped - 11 lines]
>
> Any help would be greatly appreciated.  Thank you
BB - 27 Nov 2007 11:14 GMT
Thank you Sandy Mann!!!  It works a treat!  

> I can't see OssieMac's code either but unless I am reading you wrong you
> don't need VBA.
[quoted text clipped - 25 lines]
> >
> > Any help would be greatly appreciated.  Thank you
Sandy Mann - 27 Nov 2007 11:37 GMT
You are very welcome, thanks for the feed back

Signature

Regards,

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings

sandymann2@mailinator.com
Replace @mailinator.com with @tiscali.co.uk

> Thank you Sandy Mann!!!  It works a treat!
>
[quoted text clipped - 30 lines]
>> >
>> > Any help would be greatly appreciated.  Thank you
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.