Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default Two variables for Target.Value

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Two variables for Target.Value

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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,939
Default Two variables for Target.Value

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default Two variables for Target.Value

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

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 53
Default Two variables for Target.Value

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



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default Two variables for Target.Value

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

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
Not at all clear on use of variables and/or object variables JMay-Rke Excel Discussion (Misc queries) 11 July 4th 08 06:36 PM
Target.Value lehigh46 Excel Worksheet Functions 2 April 1st 08 01:01 PM
Target cell reference moves when target is cut and pasted Illya Teideman Excel Discussion (Misc queries) 5 May 31st 07 11:34 AM
target.value Curt Excel Discussion (Misc queries) 7 April 21st 07 02:30 AM
Target Param Excel Worksheet Functions 1 March 16th 06 08:13 PM


All times are GMT +1. The time now is 11:33 AM.

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"