Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Below is my code that works for any items identified as "In Progress" what if
I want to follow the same process for both "In Progress" and "Not Started"? how would I udate the code to include both. Thanks! Private Sub Worksheet_Change(ByVal Target As Range) Dim Dest As Range If Target.Count 1 Then Exit Sub If IsEmpty(Target.Value) Then Exit Sub If Target.Column = 7 And _ Target.Row 4 And _ Target.Value < "In Progress" Then With Sheets("Complete") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) End With Range(Cells(Target.Row, 1), Cells(Target.Row, 10)).Copy Dest Target.EntireRow.Delete End If End Sub -- Thank you for your time! John |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Replace the If condition:
If Target.Column = 7 And _ Target.Row 4 And _ (Target.Value < "In Progress" Or Target.Value < "Not Started") Then -- Regards! Stefi €˛Very Basic User€¯ ezt Ć*rta: Below is my code that works for any items identified as "In Progress" what if I want to follow the same process for both "In Progress" and "Not Started"? how would I udate the code to include both. Thanks! Private Sub Worksheet_Change(ByVal Target As Range) Dim Dest As Range If Target.Count 1 Then Exit Sub If IsEmpty(Target.Value) Then Exit Sub If Target.Column = 7 And _ Target.Row 4 And _ Target.Value < "In Progress" Then With Sheets("Complete") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) End With Range(Cells(Target.Row, 1), Cells(Target.Row, 10)).Copy Dest Target.EntireRow.Delete End If End Sub -- Thank you for your time! John |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Very helpful! Thank you very much!
-- Thank you for your time! John "Stefi" wrote: Replace the If condition: If Target.Column = 7 And _ Target.Row 4 And _ (Target.Value < "In Progress" Or Target.Value < "Not Started") Then -- Regards! Stefi €˛Very Basic User€¯ ezt Ć*rta: Below is my code that works for any items identified as "In Progress" what if I want to follow the same process for both "In Progress" and "Not Started"? how would I udate the code to include both. Thanks! Private Sub Worksheet_Change(ByVal Target As Range) Dim Dest As Range If Target.Count 1 Then Exit Sub If IsEmpty(Target.Value) Then Exit Sub If Target.Column = 7 And _ Target.Row 4 And _ Target.Value < "In Progress" Then With Sheets("Complete") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) End With Range(Cells(Target.Row, 1), Cells(Target.Row, 10)).Copy Dest Target.EntireRow.Delete End If End Sub -- Thank you for your time! John |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
You are welcome! Thanks for the feedback!
-- Regards! Stefi €˛Very Basic User€¯ ezt Ć*rta: Very helpful! Thank you very much! -- Thank you for your time! John "Stefi" wrote: Replace the If condition: If Target.Column = 7 And _ Target.Row 4 And _ (Target.Value < "In Progress" Or Target.Value < "Not Started") Then -- Regards! Stefi €˛Very Basic User€¯ ezt Ć*rta: Below is my code that works for any items identified as "In Progress" what if I want to follow the same process for both "In Progress" and "Not Started"? how would I udate the code to include both. Thanks! Private Sub Worksheet_Change(ByVal Target As Range) Dim Dest As Range If Target.Count 1 Then Exit Sub If IsEmpty(Target.Value) Then Exit Sub If Target.Column = 7 And _ Target.Row 4 And _ Target.Value < "In Progress" Then With Sheets("Complete") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) End With Range(Cells(Target.Row, 1), Cells(Target.Row, 10)).Copy Dest Target.EntireRow.Delete End If End Sub -- Thank you for your time! John |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Dest As Range with Target If .Count 1 Then Exit Sub If IsEmpty(.Value) Then Exit Sub If .Column = 7 And _ .Row 4 And _ .Value < "In Progress" And _ .Value < "Not Started" Then With Sheets("Complete") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) End With Range(Cells(.Row, 1), Cells(.Row, 10)).Copy Dest .EntireRow.Delete End If End With End Sub Note This I used a with statement for Target. It makes the code a bit more compact and also a shade faster. -- HTH... Jim Thomlinson "Very Basic User" wrote: Below is my code that works for any items identified as "In Progress" what if I want to follow the same process for both "In Progress" and "Not Started"? how would I udate the code to include both. Thanks! Private Sub Worksheet_Change(ByVal Target As Range) Dim Dest As Range If Target.Count 1 Then Exit Sub If IsEmpty(Target.Value) Then Exit Sub If Target.Column = 7 And _ Target.Row 4 And _ Target.Value < "In Progress" Then With Sheets("Complete") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) End With Range(Cells(Target.Row, 1), Cells(Target.Row, 10)).Copy Dest Target.EntireRow.Delete End If End Sub -- Thank you for your time! John |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Thank you, I used the above solution, but this would have worked too. Thank
you very mucy! -- Thank you for your time! John "Jim Thomlinson" wrote: Private Sub Worksheet_Change(ByVal Target As Range) Dim Dest As Range with Target If .Count 1 Then Exit Sub If IsEmpty(.Value) Then Exit Sub If .Column = 7 And _ .Row 4 And _ .Value < "In Progress" And _ .Value < "Not Started" Then With Sheets("Complete") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) End With Range(Cells(.Row, 1), Cells(.Row, 10)).Copy Dest .EntireRow.Delete End If End With End Sub Note This I used a with statement for Target. It makes the code a bit more compact and also a shade faster. -- HTH... Jim Thomlinson "Very Basic User" wrote: Below is my code that works for any items identified as "In Progress" what if I want to follow the same process for both "In Progress" and "Not Started"? how would I udate the code to include both. Thanks! Private Sub Worksheet_Change(ByVal Target As Range) Dim Dest As Range If Target.Count 1 Then Exit Sub If IsEmpty(Target.Value) Then Exit Sub If Target.Column = 7 And _ Target.Row 4 And _ Target.Value < "In Progress" Then With Sheets("Complete") Set Dest = .Range("A" & Rows.Count).End(xlUp).Offset(1) End With Range(Cells(Target.Row, 1), Cells(Target.Row, 10)).Copy Dest Target.EntireRow.Delete End If End Sub -- Thank you for your time! John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Not at all clear on use of variables and/or object variables | Excel Discussion (Misc queries) | |||
Target.Value | Excel Worksheet Functions | |||
Target cell reference moves when target is cut and pasted | Excel Discussion (Misc queries) | |||
target.value | Excel Discussion (Misc queries) | |||
Target | Excel Worksheet Functions |