Ashish,
This works great, I'm just beginning to learn the basics of VB, To a newbie like me, the code seems strange, if you have a minute could you explain what your simple commands are doing. Maybe I can learn to expand for other options. Again, thanks for your help and support. Dave From: ashish koul [mailto:koul.ash...@gmail.com] Sent: Saturday, February 26, 2011 10:45 PM To: excel-macros@googlegroups.com Subject: Re: $$Excel-Macros$$ Insert row based on criteria hi dave Sub newrow() Dim i As Long For i = Sheets(1).Range("a1").End(xlDown).Row To 2 Step -1 If Right(Sheets(1).Cells(i, 1).Value, 5) = "Total" Then Sheets(1).Cells(i + 1, 1).EntireRow.Select Selection.Insert Shift:=xlDown End If Next i End Sub On Sun, Feb 27, 2011 at 2:38 AM, Diamond Dave <dpehr...@walbro.com> wrote: I'm also trying it insert a row, but in my example, I want to insert in after the "SubTotal" after using the "subtotal function" adding the blank row after the subtotal line. How would you modify the macro in your example to accomplish this? Dave On Feb 26, 12:44 am, Mahesh parab <mahes...@gmail.com> wrote: > Hi Jason > > find attach, hope this will help > if u use left function then its matching with u r group criteria > > Sub Mxm() > Dim LR As Long, i As Long > LR = Range("A" & Rows.Count).End(xlUp).Row > For i = LR To 3 Step -1 > If Left(Range("A" & i).Value, 2) <> Left(Range("A" & i - 1).Value, 2) > Then Rows(i).Insert > Next i > End Sub > > > > On Fri, Feb 25, 2011 at 7:21 PM, Jason Henke <jsin...@gmail.com> wrote: > > Hello, > > > In the attached file I have provided an example of what I am trying to > > accomplish via macros. > > > I import a report into excel that changes each time it's ran. I'm trying to > > put a space after each 'group' is ran. As an example we have locations set > > up as > > A-A-0 > > A-A-1 ect..to A-C-3 > > > B-A-0 to B-F-3 > > > more data in sheet to show. I would like to insert a row after each area. > > So A-A-0 to A-C-3 would be one group. B-A-0 - B-F-3 is another. Not all > > these locations will show when the report runs. If needed I can provide a > > list of every location that I need this data to sort by (and I can provide > > groups). > > > Once the rows are inserted I will be running a macro to place page breaks > > after each blank row.. this I already have though. > > > Regards, > > Jason > > > -- > > > ------------------------------------------------------------------------ ----------- > > 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 athttp://www.excel-macros.blogspot.com > > 4. Learn VBA Macros athttp://www.quickvba.blogspot.com > > 5. Excel Tips and Tricks athttp://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 > > > > insert_rows_Solutionm.xls > 62KViewDownload- Hide quoted text - > > - Show quoted text - -- ------------------------------------------------------------------------ ---------- 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/> 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