How to auto copy column D,E,F from sheet 1 to the next worksheet (egactive list) Column B,C,D after select from drop down list (eg if select “Active”)

Phobe12

New Member
Joined
Jan 13, 2023
Messages
7
Office Version
  1. 2016
How to auto copy column D,E,F from sheet 1 to the next worksheet (eg. Active list) Column B,C,D after select from drop down list (eg: if I select Active”)
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
where will this active list dropdown be. Will you just copy the row that has active.
 
Upvote 0
where will this active list dropdown be. Will you just copy the row that has active.
It will be in sheet1 (“B” column)
 

Attachments

  • 42EB5F05-446C-43FE-AC22-796170A7E571.jpeg
    42EB5F05-446C-43FE-AC22-796170A7E571.jpeg
    30.6 KB · Views: 6
  • 37BD304D-14B2-4B06-9C45-BFD148AA17DE.jpeg
    37BD304D-14B2-4B06-9C45-BFD148AA17DE.jpeg
    18.8 KB · Views: 6
Upvote 0
VBA Code:
Sub CopyData()

Dim ws1 As Worksheet
Dim ws2 As Worksheet

Set ws1 = ThisWorkbook.Sheets("Sheet2")
Set ws2 = ThisWorkbook.Sheets("Active list")
ws2.Range("B2:D" & ws2.Rows.Count).ClearContents
'Check the value of column B in sheet 1
For i = 2 To ws1.Range("B" & ws1.Rows.Count).End(xlUp).Row
    If ws1.Cells(i, 2).Value = "Active" Then
        'Copy column D, E, F from sheet 1 to column B, C, D in sheet 2
        ws1.Range(ws1.Cells(i, 4), ws1.Cells(i, 6)).Copy _
        Destination:=ws2.Cells(ws2.Range("B" & ws2.Rows.Count).End(xlUp).Row + 1, 2)
    End If
Next i

End Sub

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call CopyData

End Sub
 
Upvote 0
VBA Code:
Sub CopyData()

Dim ws1 As Worksheet
Dim ws2 As Worksheet

Set ws1 = ThisWorkbook.Sheets("Sheet2")
Set ws2 = ThisWorkbook.Sheets("Active list")
ws2.Range("B2:D" & ws2.Rows.Count).ClearContents
'Check the value of column B in sheet 1
For i = 2 To ws1.Range("B" & ws1.Rows.Count).End(xlUp).Row
    If ws1.Cells(i, 2).Value = "Active" Then
        'Copy column D, E, F from sheet 1 to column B, C, D in sheet 2
        ws1.Range(ws1.Cells(i, 4), ws1.Cells(i, 6)).Copy _
        Destination:=ws2.Cells(ws2.Range("B" & ws2.Rows.Count).End(xlUp).Row + 1, 2)
    End If
Next i

End Sub

VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call CopyData

End Sub
Thank you aaewalsh
 
Upvote 0

Forum statistics

Threads
1,214,561
Messages
6,120,239
Members
448,951
Latest member
jennlynn

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