Will someone please make a macro for me?

sherri77

New Member
Joined
Oct 5, 2006
Messages
2
I am such a beginner that I can only do the 'record' macros :oops: , but I have promised to help someone and I find that I'm not able. Would you please write a macro for me since I have run out of time and have not been able to do it, even though I have really been trying? It is Excel 2003.

There are 5 columns, A-B-C and D always have data, E seldom has data. When column E does have data, the entire row needs to move to sheet 2 and the blank row left behind needs to be deleted. It would be good if the row would move on entering after typing in data. Also, there are already 100's of rows in this report, and if the macro could move all of those, that would be great.

Thank you so much!
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Sherri

This will copy across the existing data.

Code:
Sub ccc()
  Dim OutSH As Worksheet
  Set OutSH = Sheets("sheet2")
  For i = 2 To Cells(Rows.Count, 1).End(xlUp).Row
    If Not IsEmpty(Cells(i, 5)) Then Cells(i, 1).EntireRow.Copy Destination:=OutSH.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
  Next i
  For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
    If Not IsEmpty(Cells(i, 5)) Then Cells(i, 1).EntireRow.Delete
  Next i
End Sub

Can you be a bit more specific on the "trigger" for the auto move. Will it be the entry of data into a cell in column E?


Tony
 

sherri77

New Member
Joined
Oct 5, 2006
Messages
2
THANK YOU!

Tony

I appreciate what you've done so much! The macro works perfectly!
Yes, I think the trigger for the auto move would be when the curser leaves the cell in column E after the data has been entered.

You do really really good work! Thanks for saving my life :biggrin: !!
 

acw

MrExcel MVP
Joined
Feb 13, 2004
Messages
4,814
Sherri

This worksheet_change event should get you going for the next part.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
  If Target.Cells.Count = 1 And Target.Column = 5 And Not IsEmpty(Target) Then
    Target.EntireRow.Copy Destination:=Sheets("sheet2").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
    Target.EntireRow.Delete
  End If
End Sub


Tony
 

Forum statistics

Threads
1,141,758
Messages
5,708,358
Members
421,566
Latest member
7Nabisco

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top