Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Adding a row immediately following a "true" statement

I need to add a row (keeping the format above) immediately following a 'true'
statement. I.e. if column k="C","R","RB" or "P", add row replacing
"C","R","RB" or "P" with "S".

I am trying to develop a spreadsheet to handling our invoicing for a
specific customer. Each of the above product codes needs an "S" line (for
shipping cost)



  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 834
Default Adding a row immediately following a "true" statement

Here's some code

Public Sub ProcessData()
Dim i As Long
Dim LastRow As Long

With ActiveSheet

LastRow = .Cells(.Rows.Count, "K").End(xlUp).Row
For i = LastRow To 1 Step -1

If .Cells(i, "K").Value2 = "C" Or .Cells(i, "K").Value2 = "R" Or
_
.Cells(i, "K").Value2 = "RB" Or .Cells(i, "K").Value2 = "P"
Then

.Rows(i + 1).Insert
.Cells(i + 1, "K").Value = "S"
End If
Next i
End With

End Sub

HTH

Bob

"Robb" wrote in message
...
I need to add a row (keeping the format above) immediately following a
'true'
statement. I.e. if column k="C","R","RB" or "P", add row replacing
"C","R","RB" or "P" with "S".

I am trying to develop a spreadsheet to handling our invoicing for a
specific customer. Each of the above product codes needs an "S" line (for
shipping cost)





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
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Typing "true" excel 2007 change it to "TRUE" Mr. T Excel Discussion (Misc queries) 2 April 11th 07 01:24 PM
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! [email protected] Excel Discussion (Misc queries) 3 January 5th 07 02:18 PM
Return blank for true "if" statement when charting, not 0 Jay F Charts and Charting in Excel 1 June 21st 06 04:15 PM
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


All times are GMT +1. The time now is 01:19 AM.

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

About Us

"It's about Microsoft Excel"