Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have an Excel file with several VBA inquiries, they are all working fine
except one. This particular one, each time I execute it, it's adding the answer to the one that was there before. Have been searching and trying several thing for a few hours now, and I think I will never find out why alone! If you can please help me? Thanks, Sophie Here's part of the code (it is repeated for 17 different rows and range). --- Static Sub mPfait() Range("M60,M57,M54,M51,M48,M45,M42,M39,M36,M33,M30 ,M27,M24,M21,M18,M15,M12").Select Selection.ClearContents Dim MyRange2001 As Range Set MyRange2001 = Range("U12:BZ12") Dim MyRange3001 As Range Set MyRange3001 = Range("U2:BZ2") For Each C In MyRange2001 If C.Interior.ColorIndex = 50 Then For Each D In MyRange3001 If D.Column = C.Column Then If D.Interior.ColorIndex = 38 Then mytotal2001 = mytotal2001 + C End If End If Next End If Next Range("M12") = mytotal2001 |