PC Review


Reply
Thread Tools Rate Thread

Awkward autofilter

 
 
AudiaDefila@googlemail.com
Guest
Posts: n/a
 
      24th May 2007
Hi there I am abit of a beginner.
A B
C D E F
company 1 Traffic Street Dundee 1 11/11/2006 822.03
company 1 Traffic Street Dundee 2 11/11/2006 1092.29
company 1 Traffic Street Dundee 3 11/11/2006 94.14
company 1 Traffic Street Dundee 4 10/11/2006 298.29
company 1 Traffic Street Dundee 5 10/11/2006 191.33
company 1 Traffic Street Dundee 6 10/11/2006 1145.8
company 1 Traffic Street Dundee 7 04/11/2006 9760.44
company 1 Traffic Street Dundee 8 04/11/2006 888.01
company 1 Traffic Street Dundee 9 29/10/2006 181.76
company 1 Traffic Street Dundee 10 30/10/2006 182.76
C0 2 Car Road London 1 11/11/2006
179.19
C0 2 Car Road London 2 05/11/2006
212.85
C0 2 Car Road London 3 29/10/2006
2208.91
C0 2 Car Road London 4 29/10/2006 74.75
C0 2 Car Road London 5 27/10/2006
2567.61
C0 2 Car Road London 6 30/09/2006
74.75
C0 3 Long Road Crewe 7 13/09/2006
2208.91
C0 3 Long Road Crewe 8 26/08/2006 150.4
C0 3 Long Road Crewe 9 16/08/2006 179.19
C0 3 Long Road Crewe 10 13/08/2006
307.51


I have an excel file of invoice lines from different companies.
I have written a macro to filter the duplicate details into a new
sheet.
However I need to get the invoice lines from their vertical position
into the horizontal format below. The maximum my sheet will hold is 10
invoice details.

Therefore I need an if statement which will check if the client ref in
the row below is the same. as the row above. If it is then it copies
the columns D, E,F to the row with the same client reference on
columns.


Many thanks

Mazzi

1 Ref, 1 Date, 1 Amount, 2 Ref, 2
Date, 2 Amount, ....UP TO TEN
company 1 1 11/11/2006 822.03 2 11/12/2006
1092.29
C0 2 1 16/11/2006 82.03 2 11/12/2006 1092.29

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      24th May 2007
Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long
Dim iLastCol As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 3 Step -1
If .Cells(i, "A").Value = .Cells(i - 1, "A").Value Then
iLastCol = .Cells(i, .Columns.Count).End(xlToLeft).Column
.Cells(i, "D").Resize(, iLastCol - 3).Copy .Cells(i - 1,
"G")
.Rows(i).Delete
End If
Next i

End With

End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi there I am abit of a beginner.
> A B
> C D E F
> company 1 Traffic Street Dundee 1 11/11/2006 822.03
> company 1 Traffic Street Dundee 2 11/11/2006 1092.29
> company 1 Traffic Street Dundee 3 11/11/2006 94.14
> company 1 Traffic Street Dundee 4 10/11/2006 298.29
> company 1 Traffic Street Dundee 5 10/11/2006 191.33
> company 1 Traffic Street Dundee 6 10/11/2006 1145.8
> company 1 Traffic Street Dundee 7 04/11/2006 9760.44
> company 1 Traffic Street Dundee 8 04/11/2006 888.01
> company 1 Traffic Street Dundee 9 29/10/2006 181.76
> company 1 Traffic Street Dundee 10 30/10/2006 182.76
> C0 2 Car Road London 1 11/11/2006
> 179.19
> C0 2 Car Road London 2 05/11/2006
> 212.85
> C0 2 Car Road London 3 29/10/2006
> 2208.91
> C0 2 Car Road London 4 29/10/2006 74.75
> C0 2 Car Road London 5 27/10/2006
> 2567.61
> C0 2 Car Road London 6 30/09/2006
> 74.75
> C0 3 Long Road Crewe 7 13/09/2006
> 2208.91
> C0 3 Long Road Crewe 8 26/08/2006 150.4
> C0 3 Long Road Crewe 9 16/08/2006 179.19
> C0 3 Long Road Crewe 10 13/08/2006
> 307.51
>
>
> I have an excel file of invoice lines from different companies.
> I have written a macro to filter the duplicate details into a new
> sheet.
> However I need to get the invoice lines from their vertical position
> into the horizontal format below. The maximum my sheet will hold is 10
> invoice details.
>
> Therefore I need an if statement which will check if the client ref in
> the row below is the same. as the row above. If it is then it copies
> the columns D, E,F to the row with the same client reference on
> columns.
>
>
> Many thanks
>
> Mazzi
>
> 1 Ref, 1 Date, 1 Amount, 2 Ref, 2
> Date, 2 Amount, ....UP TO TEN
> company 1 1 11/11/2006 822.03 2 11/12/2006
> 1092.29
> C0 2 1 16/11/2006 82.03 2 11/12/2006 1092.29
>



 
Reply With Quote
 
AudiaDefila@googlemail.com
Guest
Posts: n/a
 
      29th May 2007
On May 24, 5:32 pm, "Bob Phillips" <bob....@somewhere.com> wrote:
> Public Sub ProcessData()
> Const TEST_COLUMN As String = "A" '<=== change to suit
> Dim i As Long
> Dim iLastRow As Long
> Dim iLastCol As Long
>
> With ActiveSheet
>
> iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
> For i = iLastRow To 3 Step -1
> If .Cells(i, "A").Value = .Cells(i - 1, "A").Value Then
> iLastCol = .Cells(i, .Columns.Count).End(xlToLeft).Column
> .Cells(i, "D").Resize(, iLastCol - 3).Copy .Cells(i - 1,
> "G")
> .Rows(i).Delete
> End If
> Next i
>
> End With
>
> End Sub
>
> --
> ---
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
> <AudiaDef...@googlemail.com> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > Hi there I am abit of a beginner.
> > A B
> > C D E F
> > company 1 Traffic Street Dundee 1 11/11/2006 822.03
> > company 1 Traffic Street Dundee 2 11/11/2006 1092.29
> > company 1 Traffic Street Dundee 3 11/11/2006 94.14
> > company 1 Traffic Street Dundee 4 10/11/2006 298.29
> > company 1 Traffic Street Dundee 5 10/11/2006 191.33
> > company 1 Traffic Street Dundee 6 10/11/2006 1145.8
> > company 1 Traffic Street Dundee 7 04/11/2006 9760.44
> > company 1 Traffic Street Dundee 8 04/11/2006 888.01
> > company 1 Traffic Street Dundee 9 29/10/2006 181.76
> > company 1 Traffic Street Dundee 10 30/10/2006 182.76
> > C0 2 Car Road London 1 11/11/2006
> > 179.19
> > C0 2 Car Road London 2 05/11/2006
> > 212.85
> > C0 2 Car Road London 3 29/10/2006
> > 2208.91
> > C0 2 Car Road London 4 29/10/2006 74.75
> > C0 2 Car Road London 5 27/10/2006
> > 2567.61
> > C0 2 Car Road London 6 30/09/2006
> > 74.75
> > C0 3 Long Road Crewe 7 13/09/2006
> > 2208.91
> > C0 3 Long Road Crewe 8 26/08/2006 150.4
> > C0 3 Long Road Crewe 9 16/08/2006 179.19
> > C0 3 Long Road Crewe 10 13/08/2006
> > 307.51

>
> > I have an excel file of invoice lines from different companies.
> > I have written a macro to filter the duplicate details into a new
> > sheet.
> > However I need to get the invoice lines from their vertical position
> > into the horizontal format below. The maximum my sheet will hold is 10
> > invoice details.

>
> > Therefore I need an if statement which will check if the client ref in
> > the row below is the same. as the row above. If it is then it copies
> > the columns D, E,F to the row with the same client reference on
> > columns.

>
> > Many thanks

>
> > Mazzi

> 1 Ref, 1 Date, 1 Amount, 2 Ref, 2 Date, 2 Amount, (UP TO TEN)
>Co 1 1 11/11/2006 822.03 2 11/12/2006 1092.29
>Co 2 1 16/11/2006 82.03 2 11/12/2006 102.29
>
> - Show quoted text -


Hey thanks very much for your help on autofilter. Just to clarify I am
running Excel 2003.

I receive an error 1004 when I run this code which I assume was
concerning this -
http://support.microsoft.com/kb/210684.

It occurs at this line of code:-

>>>Cells(i, "D").Resize(, iLastCol - 3).Copy .Cells(i - 1,"G")


I tried to save the workbook in the macro which ran 424 Error.

Also I would like the macro to paste into specific columns after this
line of code.

Many thanks again!

Marian

 
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
Awkward query! PayeDoc Microsoft Access Queries 1 13th Nov 2008 10:45 AM
ICS on 3 laptops awkward to set up Sean Wilson Windows XP General 0 4th Dec 2006 10:42 AM
Awkward MS update Nevermind Windows XP General 3 14th Jun 2006 09:26 PM
Awkward autofilter question (URGENT!) =?Utf-8?B?R3JlZW55MTIyMjk=?= Microsoft Excel Programming 0 14th Jul 2005 06:56 PM
Awkward Exiting =?Utf-8?B?SGFyaQ==?= Microsoft Dot NET Compact Framework 5 8th Jan 2005 01:59 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:15 PM.