Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default 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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default 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?


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default 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?


.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default 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?

.


.



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
Creating form on sheet 1 and having info move to sheet 2 SHARON Excel Discussion (Misc queries) 4 June 1st 09 05:01 PM
How do I move daily data from one sheet to a 'yearly sheet' ClintH2007 Excel Worksheet Functions 3 September 10th 07 07:02 AM
Move data from sheet to sheet based on ColA Steve[_4_] Excel Programming 12 August 15th 07 09:41 PM
Move data to new sheet - rename sheet based on criteria ? [email protected] Excel Discussion (Misc queries) 7 May 16th 07 10:22 PM
move rows of data seperated in a sheet to a sheet with no separat Lynn Excel Worksheet Functions 5 December 22nd 06 03:18 AM


All times are GMT +1. The time now is 12:47 PM.

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

About Us

"It's about Microsoft Excel"