Help on transferring data based on Condition in Cell

USFengBULLS

Board Regular
Joined
May 7, 2018
Messages
66
Office Version
  1. 365
Platform
  1. Windows
Hello all,
I am trying to have data in columns A,B & C of a single row be transferred to another sheet in same column A,B & C based on a drop down list in the row. So over in row I I have it labeled Status and the whole Column (Starting at I11:I500) is an in cell drop down list that has 3 options: Sent for approval, Approved and Rejected. If the User comes in and selects approved for that Row I want it to take the data in that same row in Column A, Column B and Column C and simply transfer it to another sheet (which is just a collection of all approved samples) in the same Columns A,B and C starting at Row A11, B11, and C11. I will also need this code to count up to find the next blank row for each time something's status is changed to approved. I think this has something to do with events at the worksheet level but I am not familiar with this as I normally write code for command buttons and similar objects. Can anyone please help me with is and also writing the code for the transfer as well? Thanks
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Okay so I have written the code for the transfer:
Public Sub Status()
Dim LastRow As Integer, i As Integer, erow As Integer
LastRow = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row


For i = 11 To LastRow
If Cells(i, 9).Value = "APPROVED" Then
Range(Cells(i, 1), Cells(i, 3)).Select
Selection.Copy
Sheets("FINISH SCHEDULE").Select
erow = Sheets("FINISH SCHEDULE").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
Sheets("FINISH SCHEDULE").Cells(erow, 1).Select
Sheets("FINISH SCHEDULE").Paste
End If
Next i


End Sub

My question still remains as to how to have this macro run every time a user clicks in the column Status for the in cell drop down and selects APPROVED?
 
Upvote 0
Actually I got the Excel Event to do it from the drop down with this Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("I11")) Is Nothing Then
Select Case Range("I11")
Case "APPROVED": APPROVED
End Select
End If
End Sub


but I need this to work for Cells in the Range I11:I500
If I type this in
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("I11:I500")) Is Nothing Then
Select Case Range("I11:500")
Case "APPROVED": APPROVED
End Select
End If
End Sub

It does not work
 
Upvote 0

Forum statistics

Threads
1,223,891
Messages
6,175,229
Members
452,621
Latest member
Laura_PinksBTHFT

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
Back
Top