Copy Paste Values based on a certain cell value

rahulsteel

New Member
Joined
Apr 3, 2019
Messages
11
I have searhced a lot but have not found any vaible solution for this.
I want to know if there is any macro for this

I have a list of columns in sheet 1 like this

Group a Group B

123 456
231 415
122 313
122 122

in Sheet 2, if cell A1 = "Group a", then all the column contents are to copied. For Eg A2 should be 123, A3 should be 231, A4 should be 122 and so on.

Please advice
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Do you want to make copy only of column A ??
 
Upvote 0
See next code, to be launched from sheet 1
Code:
Option Explicit


Sub CopuColumn()
Dim j As Integer
Dim F
    For j = 1 To Cells(1, Columns.Count).End(xlToLeft).Column
        Set F = Sheets("Sheet2").Rows(1).Find(Cells(1, j), LookIn:=xlValues, Lookat:=xlWhole)
        If (Not F Is Nothing) Then
            Range(Cells(2, j), Cells(Rows.Count, j).End(3)(2)).Copy F(2)
        End If
    Next j
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,240
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