Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Fernando
 
Posts: n/a
Default 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   Report Post  
Otto Moehrbach
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy cells to another column with VBA Joe E via OfficeKB.com Excel Discussion (Misc queries) 1 January 26th 05 04:32 PM
How do I copy data (word) into respective cells when the data bei. awg9tech New Users to Excel 1 January 12th 05 11:26 AM
to copy a formula in cell c1 (+b1/b11) to cells c2-10, how can i . bvi Excel Worksheet Functions 3 December 23rd 04 06:14 PM
copy only non hidden cells Podgy Excel Worksheet Functions 1 December 8th 04 02:08 PM
copy group of cells to another group of cells using "IF" in third Chuckak Excel Worksheet Functions 2 November 10th 04 06:04 PM


All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"