[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

tcp client socket bind problem

natambu

3/10/2008 5:22:00 AM

I have a linux box with multiple ip addresses. I want to make my
python client connect from one of the ip addresses. Here is my code,
no matter what valid information I put in the bind it always comes
from the default ip address on the server. Am I doing something wrong?


-------------
#!/usr/bin/python

import socket

host = "server"
port = 1190

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

sock.bind(("<ipalias>",0))
sock.connect((host, port))
-------------


9 Answers

Marc Christiansen

3/10/2008 2:40:00 PM

0

natambu@gmail.com wrote:
> I have a linux box with multiple ip addresses. I want to make my
> python client connect from one of the ip addresses. Here is my code,
> no matter what valid information I put in the bind it always comes
> from the default ip address on the server. Am I doing something wrong?
>
> -------------
> #!/usr/bin/python
>
> import socket
>
> host = "server"
> port = 1190
>
> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>
> sock.bind(("<ipalias>",0))
> sock.connect((host, port))
> -------------

Looks good to me. Just to verify it, I added 127.1.2.3 as an address to
lo (ip addr add 127.1.2.3/8 dev lo broadcast 127.255.255.255), and...

>>> import socket
>>> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> sock.bind(("127.1.2.3",0))
>>> sock.connect(("127.0.0.1",80))

In another shell:
tolot:~> lsof -c python -a -i -nP
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
[...]
python 1287 tolot 3u IPv4 3553610 TCP 127.1.2.3:38329->127.0.0.1:80 (ESTABLISHED)

Looks correct. This is using Linux 2.6.23. So, if you're doing something
wrong, it's nothing obvious to me.

Marc

Aaron Brady

3/10/2008 4:58:00 PM

0

On Mar 10, 9:40 am, Marc Christiansen <use...@solar-empire.de> wrote:
> nata...@gmail.com wrote:
> > I have a linux box with multiple ip addresses. I want to make my
> > python client connect from one of the ip addresses. Here is my code,
> > no matter what valid information I put in the bind it always comes
> > from the default ip address on the server. Am I doing something wrong?
>
> > -------------
> > #!/usr/bin/python
>
> > import socket
>
> > host = "server"
> > port = 1190
>
> > sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>
> > sock.bind(("<ipalias>",0))
> > sock.connect((host, port))
> > -------------
>
> Looks good to me. Just to verify it, I added 127.1.2.3 as an address to
> lo (ip addr add 127.1.2.3/8 dev lo broadcast 127.255.255.255), and...
>
>  >>> import socket
>  >>> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>  >>> sock.bind(("127.1.2.3",0))
>  >>> sock.connect(("127.0.0.1",80))
>
> In another shell:
> tolot:~> lsof -c python -a -i -nP
> COMMAND  PID  USER   FD   TYPE  DEVICE SIZE NODE NAME
> [...]
> python  1287 tolot    3u  IPv4 3553610       TCP 127.1.2.3:38329->127.0.0.1:80 (ESTABLISHED)

help string:
Bind the socket to a local address. For IP sockets, the address is a
pair (host, port); the host must refer to the local host.

docs:
Bind the socket to address.

Wikipedia:
Before a socket may accept incoming connections, it must be bound.

PHP.net:
Binds the name given in address to the socket described by socket .
This has to be done before a connection is be established using
socket_connect() or socket_listen().
This function must be used on the socket before socket_connect().

Tim Roberts

3/11/2008 7:19:00 AM

0

castironpi@gmail.com wrote:
>
>On Mar 10, 9:40 am, Marc Christiansen <use...@solar-empire.de> wrote:
>> nata...@gmail.com wrote:
>> > I have a linux box with multiple ip addresses. I want to make my
>> > python client connect from one of the ip addresses. Here is my code,
>> > no matter what valid information I put in the bind it always comes
>> > from the default ip address on the server. Am I doing something wrong?
>...
>
>help string:
>Bind the socket to a local address. For IP sockets, the address is a
>pair (host, port); the host must refer to the local host.
>
>docs:
>Bind the socket to address.
>
>Wikipedia:
>Before a socket may accept incoming connections, it must be bound.
>
>PHP.net:
>Binds the name given in address to the socket described by socket .
>This has to be done before a connection is be established using
>socket_connect() or socket_listen().
>This function must be used on the socket before socket_connect().

That's all true. So what was your point? How does this help the original
poster?
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Aaron Brady

3/12/2008 7:07:00 PM

0

On Mar 11, 2:19 am, Tim Roberts <t...@probo.com> wrote:
> castiro...@gmail.com wrote:
>
> >On Mar 10, 9:40 am, Marc Christiansen <use...@solar-empire.de> wrote:
> >> nata...@gmail.com wrote:
> >> > I have a linux box with multiple ip addresses. I want to make my
> >> > python client connect from one of the ip addresses. Here is my code,
> >> > no matter what valid information I put in the bind it always comes
> >> > from the default ip address on the server. Am I doing something wrong?
> >...
>
> >help string:
> >Bind the socket to a local address.  For IP sockets, the address is a
> >pair (host, port); the host must refer to the local host.
>
> >docs:
> >Bind the socket to address.
>
> >Wikipedia:
> >Before a socket may accept incoming connections, it must be bound.
>
> >PHP.net:
> >Binds the name given in address to the socket described by socket .
> >This has to be done before a connection is be established using
> >socket_connect() or socket_listen().
> >This function must be used on the socket before socket_connect().
>
> That's all true.  So what was your point?  How does this help the original
> poster?

Confidence-- a second opinion of what the docs say. Then, something
of a criticism of the docs.

Dan Stromberg

3/12/2008 11:51:00 PM

0

On Sun, 09 Mar 2008 22:21:59 -0700, natambu wrote:

> I have a linux box with multiple ip addresses. I want to make my python
> client connect from one of the ip addresses. Here is my code, no matter
> what valid information I put in the bind it always comes from the
> default ip address on the server. Am I doing something wrong?
>
>
> -------------
> #!/usr/bin/python
>
> import socket
>
> host = "server"
> port = 1190
>
> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>
> sock.bind(("<ipalias>",0))
> sock.connect((host, port))
> -------------

I'd've expected that to work.

What does your routing table look like? You can view it with "netstat -
nr". I believe when a Linux network interface is ifconfig'd, the kernel
will add a route for that interface based on the netmask in the ifconfig,
but you could conceivably have another route that is broader overriding
the specific route.

Simon

3/26/2010 5:25:00 AM

0

Would it be easier if I supplied my xls file to better explain? Is this
possible through the forum?

"Simon" wrote:

> Hi Roger
> Thanks again for your help.
> I have never used pivot tables before thus my hesitation. But on your advice
> I will give it a go. My version is 2007.
> I might need a bit of guidance getting the pivot table created.
> As I understand it I need to create the pivot table on another sheet within
> Reports. Using the data in Sales as an external source? The PT should have a
> dynamic range?
> Cheers
> Simon
>
> "Roger Govier" wrote:
>
> > Hi Simon
> >
> > It would have been better to stay in the same thread, so people could
> > see what replies you have already had.
> >
> > Personally, I would still use a PT to do the "heavy lifting" for me in
> > terms of calculating the results. I would then pull results from the PT
> > (which could be on a hidden sheet) to my main report, along with the
> > other data you wish to collate.
> >
> > In your case, the PT would have a fixed width , but potentially a
> > growing number of rows, so there would not be a need to use the slightly
> > complicated GetPivotData function to extract your results, you could
> > simple use Index and Match.
> >
> > Supposing your Pt was on a sheet called "PT" then on your Report sheet,
> > with your products starting in A2 downward and your Months in B1 onward,
> > the formula in B2 would be
> >
> > =INDEX(PT!$1:$65536,MATCH($A2,PT!$A:$A,0),MATCH(B$1,PT!$4:$4,0))
> > This would be copied across and down as required.
> >
> > Any other data could be inserted on the report page below this.
> >
> > But if you do want to do it the hard way <bg>!!!!
> > Then Sumproduct would be the way, but be aware that on large datasets,
> > Sumproduct can be very slow. I would definitely use Dynamic Named ranges
> > for the Sumproduct formulae, rather than over long ranges just to allow
> > for more data entry, as this will limit the number of calculations
> > Sumproduct has to make.
> >
> > Rather than describe the method here in detail, take a look at the
> > tutorial I wrote at
> > http://www.contextures.com/xlNa...
> > with a sample downloadable file
> > http://www.contextures.com/Creat...
> >
> > This should show you how to do it with both Sumproduct and PT's
> >
> > If you need more help, post back (in the same thread) and also include
> > the version of Excel you are using.
> >
> > Hope this helps.
> >
> > --
> > Regards
> > Roger Govier
> >
> > Simon wrote:
> > > Workbook ???????Sales???????
> > > (A1)Product (B1)Qty (C1)Date
> > > X 2 2/1/2010
> > > X 1 10/1/2010
> > > X 3 5/3/2010
> > > Y 1 8/1/2010
> > > Y 2 5/2/2010
> > > Y 1 3/3/2010
> > > Y 1 5/3/2010
> > > Z 2 3/2/2010
> > > Z 1 5/3/2010
> > >
> > > Workbook ???????Report???????
> > > SUMQTY
> > > (A2)Product (B2)Mar10 (C2)Feb10 (D2)Jan10
> > > X 3 0 3
> > > Y 2 2 1
> > > Z 1 2 0
> > >
> > > Hi
> > > ???????Sales??????? is a excel workbook from our sales system.
> > > I would like some code to organise all the sales data found in ???????Sales??????? and
> > > group it into monthly columns in a new excel file ???????Report??????? but being new to
> > > vba I don????????t know where to start.
> > > In the workbook ???????Report???????:
> > > I want B2 to be the current month and year (Mar10), C2 to be the current
> > > month -1 (Feb10) and so on until I have 12 columns i.e 1 year.
> > > Then I want the SUM of all the QTYs for each month for each product in the
> > > correct column as shown above.
> > > Can anyone help with the code?
> > > A pivot table is not the answer because I also have other data which I want
> > > to pull in from other external workbooks
> > > Many thanks
> > >
> > > Simon
> > .
> >

ozgrid.com

3/26/2010 6:31:00 AM

0

Hi Simon

Yes, I would use a dynamic named range for a PT source
http://www.ozgrid.com/Excel/excel-pivot-...



--
Regards
Dave Hawley
www.ozgrid.com
"Simon" <Simon@discussions.microsoft.com> wrote in message
news:2FBA1991-1A9F-4946-8DFA-A142457679FF@microsoft.com...
> Hi Roger
> Thanks again for your help.
> I have never used pivot tables before thus my hesitation. But on your
> advice
> I will give it a go. My version is 2007.
> I might need a bit of guidance getting the pivot table created.
> As I understand it I need to create the pivot table on another sheet
> within
> Reports. Using the data in Sales as an external source? The PT should have
> a
> dynamic range?
> Cheers
> Simon
>
> "Roger Govier" wrote:
>
>> Hi Simon
>>
>> It would have been better to stay in the same thread, so people could
>> see what replies you have already had.
>>
>> Personally, I would still use a PT to do the "heavy lifting" for me in
>> terms of calculating the results. I would then pull results from the PT
>> (which could be on a hidden sheet) to my main report, along with the
>> other data you wish to collate.
>>
>> In your case, the PT would have a fixed width , but potentially a
>> growing number of rows, so there would not be a need to use the slightly
>> complicated GetPivotData function to extract your results, you could
>> simple use Index and Match.
>>
>> Supposing your Pt was on a sheet called "PT" then on your Report sheet,
>> with your products starting in A2 downward and your Months in B1 onward,
>> the formula in B2 would be
>>
>> =INDEX(PT!$1:$65536,MATCH($A2,PT!$A:$A,0),MATCH(B$1,PT!$4:$4,0))
>> This would be copied across and down as required.
>>
>> Any other data could be inserted on the report page below this.
>>
>> But if you do want to do it the hard way <bg>!!!!
>> Then Sumproduct would be the way, but be aware that on large datasets,
>> Sumproduct can be very slow. I would definitely use Dynamic Named ranges
>> for the Sumproduct formulae, rather than over long ranges just to allow
>> for more data entry, as this will limit the number of calculations
>> Sumproduct has to make.
>>
>> Rather than describe the method here in detail, take a look at the
>> tutorial I wrote at
>> http://www.contextures.com/xlNa...
>> with a sample downloadable file
>> http://www.contextures.com/Creat...
>>
>> This should show you how to do it with both Sumproduct and PT's
>>
>> If you need more help, post back (in the same thread) and also include
>> the version of Excel you are using.
>>
>> Hope this helps.
>>
>> --
>> Regards
>> Roger Govier
>>
>> Simon wrote:
>> > Workbook ???????Sales???????
>> > (A1)Product (B1)Qty (C1)Date
>> > X 2 2/1/2010
>> > X 1 10/1/2010
>> > X 3 5/3/2010
>> > Y 1 8/1/2010
>> > Y 2 5/2/2010
>> > Y 1 3/3/2010
>> > Y 1 5/3/2010
>> > Z 2 3/2/2010
>> > Z 1 5/3/2010
>> >
>> > Workbook ???????Report???????
>> > SUMQTY
>> > (A2)Product (B2)Mar10 (C2)Feb10 (D2)Jan10
>> > X 3 0 3
>> > Y 2 2 1
>> > Z 1 2 0
>> >
>> > Hi
>> > ???????Sales??????? is a excel workbook from our sales system.
>> > I would like some code to organise all the sales data found in
>> > ???????Sales??????? and
>> > group it into monthly columns in a new excel file ???????Report??????? but
>> > being new to
>> > vba I don????????t know where to start.
>> > In the workbook ???????Report???????:
>> > I want B2 to be the current month and year (Mar10), C2 to be the
>> > current
>> > month -1 (Feb10) and so on until I have 12 columns i.e 1 year.
>> > Then I want the SUM of all the QTYs for each month for each product in
>> > the
>> > correct column as shown above.
>> > Can anyone help with the code?
>> > A pivot table is not the answer because I also have other data which I
>> > want
>> > to pull in from other external workbooks
>> > Many thanks
>> >
>> > Simon
>> .
>>

Simon

3/26/2010 8:43:00 PM

0

OK
I have created a pivot table in PT and grouped the dates into months
It looks like this:
SumofQtySold
Item Date Total
WidgetX Jan 300
Mar 400
Jun 1200
WidgetY Jan 2000
Feb 800
etc

I have tried the formula:
Supposing your Pt was on a sheet called "PT" then on your Report sheet,
with your products starting in A4downward and your Months in K3 onward,
the formula in K4 would be

=INDEX(PT!$1:$65536,MATCH($A4,PT!$A:$A,0),MATCH(K$3,PT!$4:$4,0))

But get a #N/A

What am I doing wrong?

"ozgrid.com" wrote:

> Hi Simon
>
> Yes, I would use a dynamic named range for a PT source
> http://www.ozgrid.com/Excel/excel-pivot-...
>
>
>
> --
> Regards
> Dave Hawley
> www.ozgrid.com
> "Simon" <Simon@discussions.microsoft.com> wrote in message
> news:2FBA1991-1A9F-4946-8DFA-A142457679FF@microsoft.com...
> > Hi Roger
> > Thanks again for your help.
> > I have never used pivot tables before thus my hesitation. But on your
> > advice
> > I will give it a go. My version is 2007.
> > I might need a bit of guidance getting the pivot table created.
> > As I understand it I need to create the pivot table on another sheet
> > within
> > Reports. Using the data in Sales as an external source? The PT should have
> > a
> > dynamic range?
> > Cheers
> > Simon
> >
> > "Roger Govier" wrote:
> >
> >> Hi Simon
> >>
> >> It would have been better to stay in the same thread, so people could
> >> see what replies you have already had.
> >>
> >> Personally, I would still use a PT to do the "heavy lifting" for me in
> >> terms of calculating the results. I would then pull results from the PT
> >> (which could be on a hidden sheet) to my main report, along with the
> >> other data you wish to collate.
> >>
> >> In your case, the PT would have a fixed width , but potentially a
> >> growing number of rows, so there would not be a need to use the slightly
> >> complicated GetPivotData function to extract your results, you could
> >> simple use Index and Match.
> >>
> >> Supposing your Pt was on a sheet called "PT" then on your Report sheet,
> >> with your products starting in A2 downward and your Months in B1 onward,
> >> the formula in B2 would be
> >>
> >> =INDEX(PT!$1:$65536,MATCH($A2,PT!$A:$A,0),MATCH(B$1,PT!$4:$4,0))
> >> This would be copied across and down as required.
> >>
> >> Any other data could be inserted on the report page below this.
> >>
> >> But if you do want to do it the hard way <bg>!!!!
> >> Then Sumproduct would be the way, but be aware that on large datasets,
> >> Sumproduct can be very slow. I would definitely use Dynamic Named ranges
> >> for the Sumproduct formulae, rather than over long ranges just to allow
> >> for more data entry, as this will limit the number of calculations
> >> Sumproduct has to make.
> >>
> >> Rather than describe the method here in detail, take a look at the
> >> tutorial I wrote at
> >> http://www.contextures.com/xlNa...
> >> with a sample downloadable file
> >> http://www.contextures.com/Creat...
> >>
> >> This should show you how to do it with both Sumproduct and PT's
> >>
> >> If you need more help, post back (in the same thread) and also include
> >> the version of Excel you are using.
> >>
> >> Hope this helps.
> >>
> >> --
> >> Regards
> >> Roger Govier
> >>
> >> Simon wrote:
> >> > Workbook ???????Sales???????
> >> > (A1)Product (B1)Qty (C1)Date
> >> > X 2 2/1/2010
> >> > X 1 10/1/2010
> >> > X 3 5/3/2010
> >> > Y 1 8/1/2010
> >> > Y 2 5/2/2010
> >> > Y 1 3/3/2010
> >> > Y 1 5/3/2010
> >> > Z 2 3/2/2010
> >> > Z 1 5/3/2010
> >> >
> >> > Workbook ???????Report???????
> >> > SUMQTY
> >> > (A2)Product (B2)Mar10 (C2)Feb10 (D2)Jan10
> >> > X 3 0 3
> >> > Y 2 2 1
> >> > Z 1 2 0
> >> >
> >> > Hi
> >> > ???????Sales??????? is a excel workbook from our sales system.
> >> > I would like some code to organise all the sales data found in
> >> > ???????Sales??????? and
> >> > group it into monthly columns in a new excel file ???????Report??????? but
> >> > being new to
> >> > vba I don????????t know where to start.
> >> > In the workbook ???????Report???????:
> >> > I want B2 to be the current month and year (Mar10), C2 to be the
> >> > current
> >> > month -1 (Feb10) and so on until I have 12 columns i.e 1 year.
> >> > Then I want the SUM of all the QTYs for each month for each product in
> >> > the
> >> > correct column as shown above.
> >> > Can anyone help with the code?
> >> > A pivot table is not the answer because I also have other data which I
> >> > want
> >> > to pull in from other external workbooks
> >> > Many thanks
> >> >
> >> > Simon
> >> .
> >>
>

Simon

3/27/2010 4:24:00 AM

0

This seems to work though
Range("K4").Select
ActiveCell.FormulaR1C1 = _
"=IFERROR(GETPIVOTDATA(""Qty Sold"",PT!R1C1,""Item"",RC1,""Actual
Fulfillment Date"",MONTH(R3C)),0)"

Selection.AutoFill Destination:=Range("K4:K" & LR), Type:=xlFillDefault

And is way faster than my old sumproduct method.
Now I just have to figure out creating a dynamic range for the Pivot table.

"Simon" wrote:

> OK
> I have created a pivot table in PT and grouped the dates into months
> It looks like this:
> SumofQtySold
> Item Date Total
> WidgetX Jan 300
> Mar 400
> Jun 1200
> WidgetY Jan 2000
> Feb 800
> etc
>
> I have tried the formula:
> Supposing your Pt was on a sheet called "PT" then on your Report sheet,
> with your products starting in A4downward and your Months in K3 onward,
> the formula in K4 would be
>
> =INDEX(PT!$1:$65536,MATCH($A4,PT!$A:$A,0),MATCH(K$3,PT!$4:$4,0))
>
> But get a #N/A
>
> What am I doing wrong?
>
> "ozgrid.com" wrote:
>
> > Hi Simon
> >
> > Yes, I would use a dynamic named range for a PT source
> > http://www.ozgrid.com/Excel/excel-pivot-...
> >
> >
> >
> > --
> > Regards
> > Dave Hawley
> > www.ozgrid.com
> > "Simon" <Simon@discussions.microsoft.com> wrote in message
> > news:2FBA1991-1A9F-4946-8DFA-A142457679FF@microsoft.com...
> > > Hi Roger
> > > Thanks again for your help.
> > > I have never used pivot tables before thus my hesitation. But on your
> > > advice
> > > I will give it a go. My version is 2007.
> > > I might need a bit of guidance getting the pivot table created.
> > > As I understand it I need to create the pivot table on another sheet
> > > within
> > > Reports. Using the data in Sales as an external source? The PT should have
> > > a
> > > dynamic range?
> > > Cheers
> > > Simon
> > >
> > > "Roger Govier" wrote:
> > >
> > >> Hi Simon
> > >>
> > >> It would have been better to stay in the same thread, so people could
> > >> see what replies you have already had.
> > >>
> > >> Personally, I would still use a PT to do the "heavy lifting" for me in
> > >> terms of calculating the results. I would then pull results from the PT
> > >> (which could be on a hidden sheet) to my main report, along with the
> > >> other data you wish to collate.
> > >>
> > >> In your case, the PT would have a fixed width , but potentially a
> > >> growing number of rows, so there would not be a need to use the slightly
> > >> complicated GetPivotData function to extract your results, you could
> > >> simple use Index and Match.
> > >>
> > >> Supposing your Pt was on a sheet called "PT" then on your Report sheet,
> > >> with your products starting in A2 downward and your Months in B1 onward,
> > >> the formula in B2 would be
> > >>
> > >> =INDEX(PT!$1:$65536,MATCH($A2,PT!$A:$A,0),MATCH(B$1,PT!$4:$4,0))
> > >> This would be copied across and down as required.
> > >>
> > >> Any other data could be inserted on the report page below this.
> > >>
> > >> But if you do want to do it the hard way <bg>!!!!
> > >> Then Sumproduct would be the way, but be aware that on large datasets,
> > >> Sumproduct can be very slow. I would definitely use Dynamic Named ranges
> > >> for the Sumproduct formulae, rather than over long ranges just to allow
> > >> for more data entry, as this will limit the number of calculations
> > >> Sumproduct has to make.
> > >>
> > >> Rather than describe the method here in detail, take a look at the
> > >> tutorial I wrote at
> > >> http://www.contextures.com/xlNa...
> > >> with a sample downloadable file
> > >> http://www.contextures.com/Creat...
> > >>
> > >> This should show you how to do it with both Sumproduct and PT's
> > >>
> > >> If you need more help, post back (in the same thread) and also include
> > >> the version of Excel you are using.
> > >>
> > >> Hope this helps.
> > >>
> > >> --
> > >> Regards
> > >> Roger Govier
> > >>
> > >> Simon wrote:
> > >> > Workbook ???????Sales???????
> > >> > (A1)Product (B1)Qty (C1)Date
> > >> > X 2 2/1/2010
> > >> > X 1 10/1/2010
> > >> > X 3 5/3/2010
> > >> > Y 1 8/1/2010
> > >> > Y 2 5/2/2010
> > >> > Y 1 3/3/2010
> > >> > Y 1 5/3/2010
> > >> > Z 2 3/2/2010
> > >> > Z 1 5/3/2010
> > >> >
> > >> > Workbook ???????Report???????
> > >> > SUMQTY
> > >> > (A2)Product (B2)Mar10 (C2)Feb10 (D2)Jan10
> > >> > X 3 0 3
> > >> > Y 2 2 1
> > >> > Z 1 2 0
> > >> >
> > >> > Hi
> > >> > ???????Sales??????? is a excel workbook from our sales system.
> > >> > I would like some code to organise all the sales data found in
> > >> > ???????Sales??????? and
> > >> > group it into monthly columns in a new excel file ???????Report??????? but
> > >> > being new to
> > >> > vba I don????????t know where to start.
> > >> > In the workbook ???????Report???????:
> > >> > I want B2 to be the current month and year (Mar10), C2 to be the
> > >> > current
> > >> > month -1 (Feb10) and so on until I have 12 columns i.e 1 year.
> > >> > Then I want the SUM of all the QTYs for each month for each product in
> > >> > the
> > >> > correct column as shown above.
> > >> > Can anyone help with the code?
> > >> > A pivot table is not the answer because I also have other data which I
> > >> > want
> > >> > to pull in from other external workbooks
> > >> > Many thanks
> > >> >
> > >> > Simon
> > >> .
> > >>
> >