give this a shot. Sub macrotrythis() 'insert and label the 4 new columns --- note: your sample has (4) columns here which I presume normally are not? Columns("E:E").Insert Shift:=xlToRight: Range("E1").Value = "Sec Description" Columns("E:E").Insert Shift:=xlToRight: Range("E1").Value = "Security Code-Cash" Columns("E:E").Insert Shift:=xlToRight: Range("E1").Value = "Security Id" Columns("E:E").Insert Shift:=xlToRight: Range("E1").Value = "Txn Type" Columns("H:H").Interior.ColorIndex = 6 'turn column H yellow 'copy column K values to column Q, and column L to column R based on the "transaction code" in column(m) For Row = 2 To Range("a1").End(xlDown).Row Range("Q" & Row).Select 'just to watch the action, remove for speed 'question:your example shows the copied values moved DOWN 3 rows from source 'if this is incorrect then dont need TargetRow; ie: just use Range ("Q"&Row).value TargetRow = Row + 3 Select Case UCase(Trim(Range("M" & Row).Value)) Case "DEBIT": Range("Q" & TargetRow).Value = Range("K" & Row).Value Case "CREDIT": Range("R" & TargetRow).Value = Range("K" & Row).Value Case Else: Range("S" & TargetRow).Value = Range("K" & Row).Value End Select Next Row Columns("Q:S").AutoFit 'Columns("M:M").Delete Range("R4").Select 'end with cursor at R4 when done End Sub
-- ---------------------------------------------------------------------------------- Some important links for excel users: 1. Follow us on TWITTER for tips tricks and links : http://twitter.com/exceldailytip 2. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at http://www.excelitems.com 3. Excel tutorials at http://www.excel-macros.blogspot.com 4. Learn VBA Macros at http://www.quickvba.blogspot.com 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com To post to this group, send email to excel-macros@googlegroups.com If you find any spam message in the group, please send an email to: Ayush Jain @ jainayus...@gmail.com <><><><><><><><><><><><><><><><><><><><><><> HELP US GROW !! We reach over 6,700 subscribers worldwide and receive many nice notes about the learning and support from the group.Let friends and co-workers know they can subscribe to group at http://groups.google.com/group/excel-macros/subscribe