Products Managment Spreadsheet Problem

joejoe

New Member
Joined
Mar 11, 2009
Messages
15
Hello all ,
This is Joseph
i have A problem With Excel 2007 and Programming with it :confused:
I have made an Simple Product inventory Excel sheet ..
all what i need in it ...to program a kind of a spreadsheet that lookup for the part number in the inventory and copy all The Row that it exist in :(
First : the file of my homeinventory is homeinventory.xls
every row contains 8 columns (part number, refrence, ..etc) ..
all what i need is to search for a Single part number and copy its entire row and paste it in another spread sheet or even word sheet ..also ...if this macro can be putten in command button that's will be very nice...
i dunno if there is any way to do that
really i am sorry for my poor english (just self study of english )
also if there any one wants to help me directly ...my email is Removed e-mail address - You can put it in your profile - It's not secure out in the open - Moderator
if you don't understand what i mean ...just write some codes about
1- searching in spreadsheet for a partnumber that user write in Textbox
2- Copying the ENTIRE ROW of the result
3-pasting it in another sheet

and may also i know if i can put this codes in any other sheet (not the homeinventory sheet)

sorry for bothering
Joe :rolleyes:


sheet picture
33a5ima.jpg
 
Last edited by a moderator:
thanks very Much alan, thanks for the reply
i put the code in the "ActiveSheet" sheet , and restarted the spreadsheet , enabled macros...but the problem is that i dunno how to make the Code works...i readed your post ..you say double click the cell ...what cell? :confused: .i tried to D-click on a non-embty cell ...but it didnt't append it's row....Dunno why /Something wrong went with the code...... I need to A msgbox To put the part number in ..then it search for those cells...and then append them to "Sheet2" .... That's Alll....To be more flexible in searching for items...thanks alan
Sorry for bothering
Joe
 
Upvote 0

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Hi Joe,

Try double-clicking the cell that contains the part number that you want copying to Sheet2
 
Upvote 0
Thanks For the fast reply....whuuuh...:)
Is it possible to Just Make It append Rows Of a Word that I write In Msgbox?...Or it isn't ?.....i mean ...to be more flexible in searching for A WORD, because your code just search for the same value of the cell (by matching case) ..i need it to match entire cell content ...
thanks very much again
..:rolleyes:
 
Upvote 0
Hi Joe,

could you not just use the code I posted earlier - just write a new macro (or place in a CommandButton) to call 'SelectRows' followed by a call to 'CopySelectedRows'

Are your part numbers numeric, or text?
 
Upvote 0
thats what i was making b4 da last code...but i need to automatic copy all the rows that contains the part number...like the last code...but i mean ..i need the last code with a msg box asking for the partnumber to append it's rows...and 2 match entire cell content.....So...i mean Now i am looking for using the last code ...So.,.How can I just Make the last code Match The entire Cell Content ..
thanks Very Much
Joe :biggrin:
 
Upvote 0
thats what i was making b4 da last code...but i need to automatic copy all the rows that contains the part number...like the last code...but i mean ..i need the last code with a msg box asking for the partnumber to append it's rows...and 2 match entire cell content.....So...i mean Now i am looking for using the last code ...So.,.How can I just Make the last code Match The entire Cell Content ..
thanks Very Much
Joe :biggrin:


Hi Joe,

The code supplied should match on the entire cell contents (the 'Lookat:=xlWhole' should do this).

Alan
 
Upvote 0
Can I change The code from the start ..to Depend on a msg Box...Not The selected cell...or Maybe An textbox..anything like that?
 
Upvote 0
Hi Joe,

How about this macro:
Code:
Option Explicit

Sub FindAndCopy()
Dim lFind As Long, lTarget As Long
Dim laRows() As Long, lPtr As Long
Dim lCount As Long
Dim rFind As Range
Dim sFirstAddress As String, sRows As String
Dim sFind As String
Dim vFind As Variant
Dim wsTarget As Worksheet

vFind = Application.InputBox(prompt:="Please enter string to be searched for", _
                            Type:=2)
If vFind = False Then Exit Sub

Set wsTarget = Sheets("Sheet2")

If IsNumeric(vFind) Then
    lFind = CLng(vFind)
Else
    sFind = CStr(vFind)
End If

lTarget = wsTarget.Cells(Rows.Count, "A").End(xlUp).Row
lCount = 0
With ActiveSheet.Columns("A")
    If IsNumeric(vFind) Then
        Set rFind = .Find(CLng(vFind))
    Else
        Set rFind = .Find(CStr(vFind), lookat:=xlWhole, MatchCase:=False)
    End If
    If Not rFind Is Nothing Then
        sFirstAddress = rFind.Address
        Do
            lTarget = lTarget + 1
            lCount = lCount + 1
            wsTarget.Rows(lTarget).Value = ActiveSheet.Rows(rFind.Row).Value
            
            Set rFind = .FindNext(rFind)
            If rFind Is Nothing Then Exit Do
        Loop While rFind.Address <> sFirstAddress
    End If
End With

MsgBox lCount & " rows copied."

End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,124
Messages
6,128,993
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top