PC Review


Reply
Thread Tools Rate Thread

Adding a row immediately following a "true" statement

 
 
Robb
Guest
Posts: n/a
 
      9th Jan 2010
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 With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      9th Jan 2010
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" <(E-Mail Removed)> wrote in message
news:0B5B30E1-BBE1-4821-B8D3-(E-Mail Removed)...
>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 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
change "true" and "false" to "availble" and "out of stock" =?Utf-8?B?aW50aGVzdGFuZHM=?= Microsoft Excel Worksheet Functions 2 19th Jul 2007 07:05 PM
Typing "true" excel 2007 change it to "TRUE" =?Utf-8?B?TXIuIFQ=?= Microsoft Excel Misc 2 11th Apr 2007 01:24 PM
IIF statement in query criteria to have "Like "*" or Is Null" as the result if true bdt513@yahoo.com Microsoft Access Queries 5 19th Jul 2006 07:38 PM
Return blank for true "if" statement when charting, not 0 =?Utf-8?B?SmF5IEY=?= Microsoft Excel Charting 1 21st Jun 2006 04:15 PM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB Microsoft Excel New Users 7 13th May 2006 10:02 PM


Features
 

Advertising
 

Newsgroups
 


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