![]() |
move row to next sheet
does anyone have code that after the value of a cell in a particular column
for the active row is changed, the row is deleted and appended to another worksheet in the workbook? |
move row to next sheet
Sheet event code.
Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo stoppit Application.EnableEvents = False If Target.Address = "$A$1" And Target.Value < "" Then With Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp) .Offset(1, 0).EntireRow = Target.EntireRow.Value End With Target.EntireRow.Delete End If stoppit: Application.EnableEvents = True End Sub Gord Dibben MS Excel MVP On Tue, 16 Mar 2010 12:25:01 -0700, joemeshuggah wrote: does anyone have code that after the value of a cell in a particular column for the active row is changed, the row is deleted and appended to another worksheet in the workbook? |
move row to next sheet
this works quite nice...thanks! is there anyway to maintain the formatting
from the originating sheet? "Gord Dibben" wrote: Sheet event code. Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo stoppit Application.EnableEvents = False If Target.Address = "$A$1" And Target.Value < "" Then With Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp) .Offset(1, 0).EntireRow = Target.EntireRow.Value End With Target.EntireRow.Delete End If stoppit: Application.EnableEvents = True End Sub Gord Dibben MS Excel MVP On Tue, 16 Mar 2010 12:25:01 -0700, joemeshuggah wrote: does anyone have code that after the value of a cell in a particular column for the active row is changed, the row is deleted and appended to another worksheet in the workbook? . |
move row to next sheet
Yes, it can be done but I'm trying to visualize what you're doing.
If you copy the target row to Sheet2 with values and formats then delete the target row, your data and formats for that row are gone. The row that was below now becomes target row. Does it have data and formats also? Or maybe you just want original target row cleared of contents only, leaving a blank row with formats? Gord On Tue, 16 Mar 2010 17:06:10 -0700, joemeshuggah wrote: this works quite nice...thanks! is there anyway to maintain the formatting from the originating sheet? "Gord Dibben" wrote: Sheet event code. Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo stoppit Application.EnableEvents = False If Target.Address = "$A$1" And Target.Value < "" Then With Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp) .Offset(1, 0).EntireRow = Target.EntireRow.Value End With Target.EntireRow.Delete End If stoppit: Application.EnableEvents = True End Sub Gord Dibben MS Excel MVP On Tue, 16 Mar 2010 12:25:01 -0700, joemeshuggah wrote: does anyone have code that after the value of a cell in a particular column for the active row is changed, the row is deleted and appended to another worksheet in the workbook? . |
move row to next sheet
i believe i figured out what i needed...
Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo stoppit Application.EnableEvents = False If Target.Column = 5 And Target.Row 2 And Target.Value < "" Then With Sheets("Account-Specfic Explanations").Cells(Rows.Count, "A").End(xlUp) .Offset(1, 0).EntireRow = Target.EntireRow.Value End With Target.EntireRow.Delete With Sheets("Account-Specfic Explanations").Cells(Rows.Count, "A").End(xlUp).Resize(1, 5).Borders .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Sheets("Account-Specfic Explanations").Cells(Rows.Count, "A").End(xlUp).Offset(0, 4).WrapText = True End With End If stoppit: Application.EnableEvents = True End Sub thanks! "Gord Dibben" wrote: Yes, it can be done but I'm trying to visualize what you're doing. If you copy the target row to Sheet2 with values and formats then delete the target row, your data and formats for that row are gone. The row that was below now becomes target row. Does it have data and formats also? Or maybe you just want original target row cleared of contents only, leaving a blank row with formats? Gord On Tue, 16 Mar 2010 17:06:10 -0700, joemeshuggah wrote: this works quite nice...thanks! is there anyway to maintain the formatting from the originating sheet? "Gord Dibben" wrote: Sheet event code. Private Sub Worksheet_Change(ByVal Target As Excel.Range) On Error GoTo stoppit Application.EnableEvents = False If Target.Address = "$A$1" And Target.Value < "" Then With Sheets("Sheet2").Cells(Rows.Count, "A").End(xlUp) .Offset(1, 0).EntireRow = Target.EntireRow.Value End With Target.EntireRow.Delete End If stoppit: Application.EnableEvents = True End Sub Gord Dibben MS Excel MVP On Tue, 16 Mar 2010 12:25:01 -0700, joemeshuggah wrote: does anyone have code that after the value of a cell in a particular column for the active row is changed, the row is deleted and appended to another worksheet in the workbook? . . |
All times are GMT +1. The time now is 04:51 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com