Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA code required (for.......next loop)

Hi

Can anyone help with some code for a macro I need. I have
enclosed a .xls file which explains what I need to achieve. I need
a for........next loop to loop down a column looking for certai
products and then giving a sum of the values in the next column fo
each particular item, but only if there is no entry in the third colum
(a date value) for each row.

The enclosed file explains this better and I hope someone can advis
me, The file is macro & virus free.

Thank

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Excel VBA code required (for.......next loop)

Hi
without looking at your file (as I don't see it) do you
require a macro or would a worksheet function work for you
also. If yes you may use SUMPRODUCT. e.g.
=SUMPRODUCT(--(A1:A1000="product_name1"),--
(C1:C1000=""),B1:B1000)

-----Original Message-----
Hi

Can anyone help with some code for a macro I need. I have
enclosed a .xls file which explains what I need to

achieve. I need
a for........next loop to loop down a column looking for

certain
products and then giving a sum of the values in the next

column for
each particular item, but only if there is no entry in

the third column
(a date value) for each row.

The enclosed file explains this better and I hope someone

can advise
me, The file is macro & virus free.

Thanks


---
Message posted from http://www.ExcelForum.com/

.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA code required (for.......next loop)

Thanks

I will try this. If it won't work can I email the .xls file to you for
clarification.

VC


---
Message posted from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA code required (for.......next loop)

Thanks

This did work on the current list in the worksheet. I adapted th
formula t
=SUMPRODUCT(--(Orders!$D$8:$D$100="83201220"),--(Orders!$K$8:$K$100=""),Orders!$G$8:$G$100)....... ..thi
works
fine as the product 83201220 was already in the list on the Order
sheet.

When I added product 83201020 to the list on the Orders sheet and use
the formul
=SUMPRODUCT(--(Orders!$D$8:$D$100="83201020"),--(Orders!$K$8:$K$100=""),Orders!$G$8:$G$100).....th i
failed to work.

Have you any idea why this might be.

Thanks

V

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Excel VBA code required (for.......next loop)

Hi
does
=SUMPRODUCT(--(Orders!$D$8:$D$100=83201020),--(Orders!$K$8:$K$100=""),O
rders!$G$8:$G$100)
work?
If no what is your exact problem with the existing formula?

--
Regards
Frank Kabel
Frankfurt, Germany


Thanks

This did work on the current list in the worksheet. I adapted the
formula to

=SUMPRODUCT(--(Orders!$D$8:$D$100="83201220"),--(Orders!$K$8:$K$100="")
,Orders!$G$8:$G$100).........this
works
fine as the product 83201220 was already in the list on the Orders
sheet.

When I added product 83201020 to the list on the Orders sheet and

used
the formula

=SUMPRODUCT(--(Orders!$D$8:$D$100="83201020"),--(Orders!$K$8:$K$100="")
,Orders!$G$8:$G$100).....this
failed to work.

Have you any idea why this might be.

Thanks

VC


---
Message posted from http://www.ExcelForum.com/




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel VBA code required (for.......next loop)

Thank you

This is strange. When I set up the formula on the worksheet I had
some products in the range D8:D28 and the formula worked fine
with the product code in speech marks ie "83201220".

When I added items to cells D9 onwards it didn't work. I change th
formula to your suggestion ie without speech marks and it work
fine????

Do you know why although I'm happy it works and thanks for your help.

V

--
Message posted from http://www.ExcelForum.com

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Another VB Code Required TGV Excel Discussion (Misc queries) 7 February 7th 09 07:21 AM
VB Code Required TGV Excel Discussion (Misc queries) 3 February 6th 09 05:31 PM
macro code required muddan madhu Excel Worksheet Functions 2 April 28th 08 03:43 PM
VB for excel, how do I loop through code steve hobden via OfficeKB.com Excel Discussion (Misc queries) 2 June 9th 05 01:59 PM
For....Next loop code required uplink600 Excel Programming 2 May 12th 04 04:03 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"