Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
Typing "true" excel 2007 change it to "TRUE" | Excel Discussion (Misc queries) | |||
Help!!! Enter "7" in a cell and Excel changes the "7" to "11" immediately!!! | Excel Discussion (Misc queries) | |||
Return blank for true "if" statement when charting, not 0 | Charts and Charting in Excel | |||
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next | New Users to Excel |