Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 477
Default Insert New row if Column G = "P"

I can't seem to get this, but
if I wanted to run a macro that
would start at cell G50 and
move upward to Cell G18 testing for the
value P and if it is found insert a single
row beneath it (passing on all other
rows that do not have P), how would I
do this?
TIA,

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,339
Default Insert New row if Column G = "P"

Try:

Sub InsertRow()
For irow = 50 To 8 Step -1
If Cells(irow, "G") = "P" Then
Cells(irow + 1, "G").Insert Shift:=xlDown
End If
Next irow
End Sub

"Jim May" wrote:

I can't seem to get this, but
if I wanted to run a macro that
would start at cell G50 and
move upward to Cell G18 testing for the
value P and if it is found insert a single
row beneath it (passing on all other
rows that do not have P), how would I
do this?
TIA,

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chg 1 "Last, First Mid" column to 3 "First", "Middle", "Last" colu JBird11002 Excel Discussion (Misc queries) 4 August 15th 08 06:31 PM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Lost "File Menu" - now it's "Edit / View / Insert.." but no "F daves Excel Discussion (Misc queries) 3 April 24th 07 04:52 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM


All times are GMT +1. The time now is 10:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"