PC Review


Reply
Thread Tools Rate Thread

add lines to a order list

 
 
vitorjose
Guest
Posts: n/a
 
      20th Dec 2007
Hello i am hoping that you can provide some help.

I have a workbook with 2 worksheets -

Workbook A contains a record of custoemr orders - one order per row -
columns H to M contains the qty of a specifec product (each column
represents a differenct product) -

Customer Name.............Product type A....Product Type B.....Product
Type C
Company A............................
3........................3........................3...........

Workbook B - contains a record of each item ordered from workbook A -
A customer who orders qty 3 of 3 different items (Columns H to M in
workbook A) would have 9 records - multiples of a single item would
each have there own row - with a different id

"Company A" - "Product Type A " - No 1
"Company A" - "Product Type A " - No 2
"Company A" - "Product Type A " - No 3
"Company A" - "Product Type B " - No 1
"Company A" - "Product Type B " - No 2
"Company A" - "Product Type B " - No 3
"Company A" - "Product Type C " - No 1
"Company A" - "Product Type C " - No 2
"Company A" - "Product Type C " - No 3


My issue is that i would like Workbook B to automatically update
whenever a new order is entered in Workbook A - Someone would enter in
information and then initiate a macro that would take the info for
that order and create entries on Workbook B -

As a further enhancement - it would also be great if changes to an
existing order (Workbook A) could also be reflected in Workbook B

Thanks in advance for your help

Victor P
 
Reply With Quote
 
 
 
 
Dan R.
Guest
Posts: n/a
 
      20th Dec 2007
Victor,

This is no small task but this should get you started. Right click
your "Workbook A" tab and hit 'View Code', then paste this in there:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim custLookup As Range, lRow As Long
If Target.Cells.Count > 1 Or _
Target.Value = "" Then Exit Sub
With Sheets(2)
lRow = .Cells(.Rows.Count, 1).End(xlUp).Row
End With
Select Case Target.Column
Case Is = 1
Set custLookup = Sheets(2).Columns("A").Find( _
What:=Target.Value, _
LookIn:=xlValues, _
MatchCase:=False)
If custLookup Is Nothing Then
Target.Copy Sheets(2).Cells(lRow + 1, 1)
Else
If MsgBox("This customer already exists. " & _
"Would you like to add them again?", _
vbYesNo) = vbYes Then
Target.Copy Sheets(2).Cells(lRow + 1, 1)
End If
End If
Case Is = 2
' do stuff
End Select
End Sub

--
Dan


On Dec 20, 2:58 pm, vitorjose <victor_pa...@cox.net> wrote:
> Hello i am hoping that you can provide some help.
>
> I have a workbook with 2 worksheets -
>
> Workbook A contains a record of custoemr orders - one order per row -
> columns H to M contains the qty of a specifec product (each column
> represents a differenct product) -
>
> Customer Name.............Product type A....Product Type B.....Product
> Type C
> Company A............................
> 3........................3........................3...........
>
> Workbook B - contains a record of each item ordered from workbook A -
> A customer who orders qty 3 of 3 different items (Columns H to M in
> workbook A) would have 9 records - multiples of a single item would
> each have there own row - with a different id
>
> "Company A" - "Product Type A " - No 1
> "Company A" - "Product Type A " - No 2
> "Company A" - "Product Type A " - No 3
> "Company A" - "Product Type B " - No 1
> "Company A" - "Product Type B " - No 2
> "Company A" - "Product Type B " - No 3
> "Company A" - "Product Type C " - No 1
> "Company A" - "Product Type C " - No 2
> "Company A" - "Product Type C " - No 3
>
> My issue is that i would like Workbook B to automatically update
> whenever a new order is entered in Workbook A - Someone would enter in
> information and then initiate a macro that would take the info for
> that order and create entries on Workbook B -
>
> As a further enhancement - it would also be great if changes to an
> existing order (Workbook A) could also be reflected in Workbook B
>
> Thanks in advance for your help
>
> Victor P

 
Reply With Quote
 
vitorjose
Guest
Posts: n/a
 
      21st Dec 2007
Dan

Thanks i will give this a try



On Dec 20, 6:18*pm, "Dan R." <Dan.R.Oa...@gmail.com> wrote:
> Victor,
>
> This is no small task but this should get you started. Right click
> your "Workbook A" tab and hit 'View Code', then paste this in there:
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> * *Dim custLookup As Range, lRow As Long
> * *If Target.Cells.Count > 1 Or _
> * * * Target.Value = "" Then Exit Sub
> * *With Sheets(2)
> * * * lRow = .Cells(.Rows.Count, 1).End(xlUp).Row
> * *End With
> * *Select Case Target.Column
> * * * Case Is = 1
> * * * * *Set custLookup = Sheets(2).Columns("A").Find( _
> * * * * * * * *What:=Target.Value, _
> * * * * * * * *LookIn:=xlValues, _
> * * * * * * * *MatchCase:=False)
> * * * * *If custLookup Is Nothing Then
> * * * * * * Target.Copy Sheets(2).Cells(lRow + 1, 1)
> * * * * *Else
> * * * * * * If MsgBox("This customer already exists. " & _
> * * * * * * * * * "Would you like to add them again?", _
> * * * * * * * * * vbYesNo) = vbYes Then
> * * * * * * * *Target.Copy Sheets(2).Cells(lRow + 1, 1)
> * * * * * * End If
> * * * * *End If
> * * * Case Is = 2
> * * * * *' do stuff
> * *End Select
> End Sub
>
> --
> Dan
>
> On Dec 20, 2:58 pm, vitorjose <victor_pa...@cox.net> wrote:
>
> > Hello i am hoping that you can provide some help.

>
> > I have a workbook with 2 worksheets -

>
> > Workbook A contains a record of custoemr orders - one order per row -
> > columns H to M contains the qty of a specifec product (each column
> > represents a differenct product) -

>
> > Customer Name.............Product type A....Product Type B.....Product
> > Type C
> > Company A............................
> > 3........................3........................3...........

>
> > Workbook B - contains a record of each item ordered from workbook A -
> > A customer who orders qty 3 of 3 different items (Columns H to M in
> > workbook A) would have 9 records - multiples of a single item would
> > each have there own row - with a different id

>
> > "Company A" - "Product Type A " - *No 1
> > "Company A" - "Product Type A " - *No 2
> > "Company A" - "Product Type A " - *No 3
> > "Company A" - "Product Type B " - *No 1
> > "Company A" - "Product Type B " - *No 2
> > "Company A" - "Product Type B " - *No 3
> > "Company A" - "Product Type C " - *No 1
> > "Company A" - "Product Type C " - *No 2
> > "Company A" - "Product Type C " - *No 3

>
> > My issue is that i would like Workbook B to automatically update
> > whenever a new order is entered in Workbook A - Someone would enter in
> > information *and then initiate a macro that would take the info for
> > that order and create entries on Workbook B -

>
> > As a further enhancement - it would also be great if changes to an
> > existing order (Workbook A) could also be reflected in Workbook B

>
> > Thanks in advance for your help

>
> > Victor P


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Order By in Property List - but put in DESCENDING order =?Utf-8?B?TWFjTnV0MjAwNA==?= Microsoft Access Forms 4 19th Jun 2008 09:46 PM
the order of chart lines cvgairport Microsoft Excel Charting 1 18th Feb 2008 04:16 PM
Query to order lines a certain way cappiel@comcast.net Microsoft Access Queries 3 5th Feb 2008 02:39 PM
Name order in Contact list different from name order when sending mail resonator80 Microsoft Outlook Discussion 2 8th Feb 2007 06:34 PM
how do I get my reports to list in day order vs. year order? =?Utf-8?B?SmFjQ2VlQmVl?= Microsoft Access Reports 1 29th Nov 2005 01:45 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:54 PM.