PC Review


Reply
Thread Tools Rate Thread

Add new rows after specific rows

 
 
Dipladenia
Guest
Posts: n/a
 
      12th Dec 2007
Hello!

I would like to add a new row after each row that contains the value "SHOW
MOVIE_PLAYER" in column F (that is, column F contains a number of different
values, and I just want a new row after the ones with that specific value).

I COULD just insert a new row manually, but there´s about 500 of them...

Can anyone help me with this?

Thanks
/Dipladenia
 
Reply With Quote
 
 
 
 
Dipladenia
Guest
Posts: n/a
 
      12th Dec 2007
Additional info: I´m using Excel 2003 SP2

/Dipladenia


"Dipladenia" skrev:

> Hello!
>
> I would like to add a new row after each row that contains the value "SHOW
> MOVIE_PLAYER" in column F (that is, column F contains a number of different
> values, and I just want a new row after the ones with that specific value).
>
> I COULD just insert a new row manually, but there´s about 500 of them...
>
> Can anyone help me with this?
>
> Thanks
> /Dipladenia

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      12th Dec 2007
Public Sub ProcessData()
Const TEST_COLUMN As String = "F" '<=== change to suit
Dim i As Long
Dim iLastRow As Long

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = iLastRow To 1 Step -1
If .Cells(i, TEST_COLUMN).Value = "SHOW MOVIE_PLAYER" Then
.Rows(i + 1).Insert
End If
Next i
End With

End Sub


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Dipladenia" <(E-Mail Removed)> wrote in message
news:2AAAC843-52A1-4DD9-9F26-(E-Mail Removed)...
> Hello!
>
> I would like to add a new row after each row that contains the value "SHOW
> MOVIE_PLAYER" in column F (that is, column F contains a number of
> different
> values, and I just want a new row after the ones with that specific
> value).
>
> I COULD just insert a new row manually, but there´s about 500 of them...
>
> Can anyone help me with this?
>
> Thanks
> /Dipladenia



 
Reply With Quote
 
gaddis
Guest
Posts: n/a
 
      28th Feb 2008
how do I get this to work in 2007?
--
THANKS!
mg


"Bob Phillips" wrote:

> Public Sub ProcessData()
> Const TEST_COLUMN As String = "F" '<=== change to suit
> Dim i As Long
> Dim iLastRow As Long
>
> With ActiveSheet
>
> iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
> For i = iLastRow To 1 Step -1
> If .Cells(i, TEST_COLUMN).Value = "SHOW MOVIE_PLAYER" Then
> .Rows(i + 1).Insert
> End If
> Next i
> End With
>
> End Sub
>
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my addy)
>
> "Dipladenia" <(E-Mail Removed)> wrote in message
> news:2AAAC843-52A1-4DD9-9F26-(E-Mail Removed)...
> > Hello!
> >
> > I would like to add a new row after each row that contains the value "SHOW
> > MOVIE_PLAYER" in column F (that is, column F contains a number of
> > different
> > values, and I just want a new row after the ones with that specific
> > value).
> >
> > I COULD just insert a new row manually, but there´s about 500 of them...
> >
> > Can anyone help me with this?
> >
> > Thanks
> > /Dipladenia

>
>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      28th Feb 2008
Same way it works in previous versions.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

gaddis wrote:
>
> how do I get this to work in 2007?
> --
> THANKS!
> mg
>
> "Bob Phillips" wrote:
>
> > Public Sub ProcessData()
> > Const TEST_COLUMN As String = "F" '<=== change to suit
> > Dim i As Long
> > Dim iLastRow As Long
> >
> > With ActiveSheet
> >
> > iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
> > For i = iLastRow To 1 Step -1
> > If .Cells(i, TEST_COLUMN).Value = "SHOW MOVIE_PLAYER" Then
> > .Rows(i + 1).Insert
> > End If
> > Next i
> > End With
> >
> > End Sub
> >
> >
> > --
> > HTH
> >
> > Bob
> >
> > (there's no email, no snail mail, but somewhere should be gmail in my addy)
> >
> > "Dipladenia" <(E-Mail Removed)> wrote in message
> > news:2AAAC843-52A1-4DD9-9F26-(E-Mail Removed)...
> > > Hello!
> > >
> > > I would like to add a new row after each row that contains the value "SHOW
> > > MOVIE_PLAYER" in column F (that is, column F contains a number of
> > > different
> > > values, and I just want a new row after the ones with that specific
> > > value).
> > >
> > > I COULD just insert a new row manually, but there´s about 500 of them...
> > >
> > > Can anyone help me with this?
> > >
> > > Thanks
> > > /Dipladenia

> >
> >
> >


--

Dave Peterson
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting characters in multiple rows when rows meet specific criteria news.virginmedia.com Microsoft Excel Worksheet Functions 3 28th Jun 2008 09:03 PM
Deleting specific rows with a specific criteria using inputbox Greg Microsoft Excel Programming 2 10th Apr 2008 04:31 PM
VBA to count rows from specific cell and insert rows Valerie Microsoft Excel Programming 3 26th Nov 2007 10:14 PM
Hiding Specific Rows Based on Values in Other Rows Chris Microsoft Excel Worksheet Functions 1 2nd Nov 2006 08:21 PM
Removing Empty Rows and selecting Specific Rows Jetheat Microsoft Excel Programming 7 12th Aug 2005 12:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:51 AM.