Home |
Search |
Today's Posts |
#1
|
|||
|
|||
code to Copy cells from the above row.
Hello Everyone,
I need a code for a excel sheet. If you press the Enter on Column G, And the below row is completely empty (I mean all the cells), Copy Column A B C D E from the above row (the Row that you were before pressing the Enter) to the new row (the below Row, Row that you are in after pressin the Enter) and Column F should be the selected cell. Big thanks in advance. |
#2
|
|||
|
|||
Fernando
The macro you need is a Worksheet_Change event macro and must be put in the sheet module of the sheet in which you want this to happen. Note that this macro will fire upon a change to the contents of any cell in column G, not just when you hit Enter with the active cell in Column G. If you want this to fire when you simply select a cell in column G, then you need a Worksheet_SelectionChange event macro. The macros is below. I am also sending you a small file with that macro in the right place. HTH Otto Private Sub Worksheet_Change(ByVal Target As Range) If Target.Count 1 Then Exit Sub If Target.Column < 7 Then Exit Sub If Application.CountA(Range(Cells(Target.Row + 1, 1), Cells(Target.Row + 1, 256))) = 0 Then Target.Offset(, -6).Resize(, 5).Copy Cells(Target.Row + 1, 1) Target.Offset(1, -1).Select End If End Sub "Fernando" wrote in message om... Hello Everyone, I need a code for a excel sheet. If you press the Enter on Column G, And the below row is completely empty (I mean all the cells), Copy Column A B C D E from the above row (the Row that you were before pressing the Enter) to the new row (the below Row, Row that you are in after pressin the Enter) and Column F should be the selected cell. Big thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Copy cells to another column with VBA | Excel Discussion (Misc queries) | |||
How do I copy data (word) into respective cells when the data bei. | New Users to Excel | |||
to copy a formula in cell c1 (+b1/b11) to cells c2-10, how can i . | Excel Worksheet Functions | |||
copy only non hidden cells | Excel Worksheet Functions | |||
copy group of cells to another group of cells using "IF" in third | Excel Worksheet Functions |