try this Sub testtttt() Sheets("Filter Test").Select 'Insert columns for filter forumulas
Range("C4").Select Selection.EntireColumn.Insert Selection.EntireColumn.Insert Selection.EntireColumn.Insert 'fill in blanks is column C,D and E Range("B3:E3").Select Selection.FillRight Range("D4").Formula = "=IF(SUM(E4:E8)>0,1,0)" Range("e4").Formula = "=SUM(F4:CO4)" Range("d4:e" & Range("a1048576").End(xlUp).Row).Select Selection.FillDown For i = 9 To Range("a1048576").End(xlUp).Row Range("D" & i).Interior.Color = vbRed Range("e" & i).Interior.Color = vbyellow Range("D" & i).Formula = "=SUM(d" & i - 1 & ":d" & i - 5 & ")" Range("e" & i).Formula = "=SUM(e" & i - 1 & ":e" & i - 5 & ")" i = i + 5 Next End Sub On Wed, Aug 3, 2011 at 3:49 PM, Pehrson, Dave <dpehr...@walbro.com> wrote: > The attached is a worksheet that I’m working with, actually the data runs > to over 100,000 lines, but I have shortened the example. Macro1 contains a > formula that I wish to place into cells D4 to E9, then copy and paste to the > end of the data.**** > > ** ** > > Note, each block is a set of 5 line for one part, so the formulas in line > D4 to E9 are different. And must be copied in sets. I can do it manually, > but the macro will not work.**** > > ** ** > > Currently I get an error when the process runs, but I don’t know if my > program language in not correct, or is Visual Basic cannot do. Any > suggestions? Would removing the blank rows help?**** > > ** ** > > Any support would be appreciated.**** > > ** ** > > Thanks**** > > Dave**** > > ** ** > > ** ** > > David Pehrson**** > > Materials Manager, Lawn and Garden North America**** > > Walbro Engine Management, LLC**** > > 7400 North Oracle, Suite 311**** > > Tucson, AZ 85704**** > > Office (520) 229-5694**** > > Cell (520) 780-1364**** > > Fax (520) 877-3006**** > > ** ** > > Confidentiality Notice: The materials contained within this e-mail > transmission (including all attachments) are private and confidential and > the property of the sender. The information contained in the materials is > priveleged and intended only for the named addressee(s). If you are not the > intended addressee, be advised that any unauthorized disclosure, copying, > distribution or the taking of any action in reliance on the contents of this > material is strictly prohibited. If you have received this e-mail > transmission in error, please immediately notify the sender by telephone > at 520-229-5694 or send an e-mail to > dpehr...@walbro.com<jki...@walbro.com>and thereafter destroy the e-mail you > received and all copies thereof. > **** > > ** ** > > -- > > ---------------------------------------------------------------------------------- > Some important links for excel users: > 1. Follow us on TWITTER for tips tricks and links : > http://twitter.com/exceldailytip > 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 > 3. Excel tutorials at http://www.excel-macros.blogspot.com > 4. Learn VBA Macros at http://www.quickvba.blogspot.com > 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com > > To post to this group, send email to excel-macros@googlegroups.com > > <><><><><><><><><><><><><><><><><><><><><><> > Like our page on facebook , Just follow below link > http://www.facebook.com/discussexcel > -- *Regards* * * *Ashish Koul* *akoul*.*blogspot*.com <http://akoul.blogspot.com/> http://akoul.posterous.com/ *akoul*.wordpress.com <http://akoul.wordpress.com/> My Linkedin Profile <http://in.linkedin.com/pub/ashish-koul/10/400/830> P Before printing, think about the environment. -- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com <><><><><><><><><><><><><><><><><><><><><><> Like our page on facebook , Just follow below link http://www.facebook.com/discussexcel
<<image001.gif>>