![]() |
IF value = "DEC" or "MAR" cut and paste 3 cells
I need to search column B and if I find DEC, MAR, JUN, or SEP I need to cut
the cells from that row in column B, C and D and paste them in C, D and E. e.g. Column B C D E PUT MAR 9 SP CALL DEC 8 IND DEC 8 SP 500 CALL JAN 9 IND MAR 9 SP 500 After running macro, should line up as below: Column B C D E PUT MAR 9 SP CALL DEC 8 IND DEC 8 SP CALL JAN 9 IND MAR 9 SP Any help is greatly appreciated. Thanks |
IF value = "DEC" or "MAR" cut and paste 3 cells
this seems to work
Sub tryme() Application.ScreenUpdating = False mylast = Cells(Cells.Rows.Count, "B").End(xlUp).Row For j = 1 To mylast 'DEC, MAR, JUN, or SEP If Cells(j, "B") = "DEC" Or Cells(j, "B") = "MAR" Or _ Cells(j, "B") = "JUN" Or Cells(j, "B") = "SEP" Then Cells(j, "F") = Cells(j, "E") Cells(j, "E") = Cells(j, "D") Cells(j, "C") = Cells(j, "B") Cells(j, "B") = "" End If Next j Application.ScreenUpdating = True End Sub best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "aileen" wrote in message ... I need to search column B and if I find DEC, MAR, JUN, or SEP I need to cut the cells from that row in column B, C and D and paste them in C, D and E. e.g. Column B C D E PUT MAR 9 SP CALL DEC 8 IND DEC 8 SP 500 CALL JAN 9 IND MAR 9 SP 500 After running macro, should line up as below: Column B C D E PUT MAR 9 SP CALL DEC 8 IND DEC 8 SP CALL JAN 9 IND MAR 9 SP Any help is greatly appreciated. Thanks |
IF value = "DEC" or "MAR" cut and paste 3 cells
Thanks so much. It worked perfectly with one minor adjustment.
"Bernard Liengme" wrote: this seems to work Sub tryme() Application.ScreenUpdating = False mylast = Cells(Cells.Rows.Count, "B").End(xlUp).Row For j = 1 To mylast 'DEC, MAR, JUN, or SEP If Cells(j, "B") = "DEC" Or Cells(j, "B") = "MAR" Or _ Cells(j, "B") = "JUN" Or Cells(j, "B") = "SEP" Then Cells(j, "F") = Cells(j, "E") Cells(j, "E") = Cells(j, "D") Cells(j, "C") = Cells(j, "B") Cells(j, "B") = "" End If Next j Application.ScreenUpdating = True End Sub best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "aileen" wrote in message ... I need to search column B and if I find DEC, MAR, JUN, or SEP I need to cut the cells from that row in column B, C and D and paste them in C, D and E. e.g. Column B C D E PUT MAR 9 SP CALL DEC 8 IND DEC 8 SP 500 CALL JAN 9 IND MAR 9 SP 500 After running macro, should line up as below: Column B C D E PUT MAR 9 SP CALL DEC 8 IND DEC 8 SP CALL JAN 9 IND MAR 9 SP Any help is greatly appreciated. Thanks |
IF value = "DEC" or "MAR" cut and paste 3 cells
Great, thanks for the feedback
-- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "aileen" wrote in message ... Thanks so much. It worked perfectly with one minor adjustment. "Bernard Liengme" wrote: this seems to work Sub tryme() Application.ScreenUpdating = False mylast = Cells(Cells.Rows.Count, "B").End(xlUp).Row For j = 1 To mylast 'DEC, MAR, JUN, or SEP If Cells(j, "B") = "DEC" Or Cells(j, "B") = "MAR" Or _ Cells(j, "B") = "JUN" Or Cells(j, "B") = "SEP" Then Cells(j, "F") = Cells(j, "E") Cells(j, "E") = Cells(j, "D") Cells(j, "C") = Cells(j, "B") Cells(j, "B") = "" End If Next j Application.ScreenUpdating = True End Sub best wishes -- Bernard V Liengme Microsoft Excel MVP http://people.stfx.ca/bliengme remove caps from email "aileen" wrote in message ... I need to search column B and if I find DEC, MAR, JUN, or SEP I need to cut the cells from that row in column B, C and D and paste them in C, D and E. e.g. Column B C D E PUT MAR 9 SP CALL DEC 8 IND DEC 8 SP 500 CALL JAN 9 IND MAR 9 SP 500 After running macro, should line up as below: Column B C D E PUT MAR 9 SP CALL DEC 8 IND DEC 8 SP CALL JAN 9 IND MAR 9 SP Any help is greatly appreciated. Thanks |
All times are GMT +1. The time now is 11:18 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com