Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Another VB Code Required | Excel Discussion (Misc queries) | |||
VB Code Required | Excel Discussion (Misc queries) | |||
macro code required | Excel Worksheet Functions | |||
VB for excel, how do I loop through code | Excel Discussion (Misc queries) | |||
For....Next loop code required | Excel Programming |