find match values and copy

asyamonique

Well-known Member
Joined
Jan 29, 2008
Messages
1,286
Office Version
  1. 2013
Platform
  1. Windows
Good Day,
I have a datas on the columns ("A1:C1500)
I want to populate those values into columns (H:J)
which matching the cell ("M1") value , with column ("C") values all the way down..
Many Thanks
 
Perhaps like this

Rich (BB code):
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
With Range("A" & i)
If .Value = ComboBox1.Value Then
.Offset(, 1).Resize(, 4).Copy
Range("AE" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
End If
End With
Next i
 
Range("AE" & Rows.Count).End(xlUp).Offset(2).Value = " "
If ComboBox2.Value = "" Then Exit Sub
Dim LMR As Long, ip As Long
LMR = Range("A" & Rows.Count).End(xlUp).Row
For ip = 1 To LMR
With Range("A" & ip)
If .Value = ComboBox2.Value Then
.Offset(, 1).Resize(, 4).Copy
Range("AE" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
End If
End With
Next ip

Thanks for helping.
Cheers
 
Upvote 0

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Perhaps like this

Rich (BB code):
Sub test()
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
    With Range("C" & i)
        If .Value = Range("M1").Value Then
            .Offset(, -2).Resize(, 3).Copy
            Range("H" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
        End If
    End With
Next i
Range("H" & Rows.Count).End(xlUp).Offset(1).Value = " "
End Sub

Code:
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 1 To LR
With Range("A" & i)
If .Value = ComboBox1.Value Then
.Offset(, 1).Resize(, 26).Copy
Range("AE" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
End If
End With
Next i
 
Range("AE" & Rows.Count).End(xlUp).Offset(2).Value = " "
[COLOR=black]If ComboBox2.Value = "" Then Exit Sub[/COLOR]
[COLOR=black]
[/COLOR]Dim LMR As Long, ip As Long
LMR = Range("A" & Rows.Count).End(xlUp).Row
For ip = 1 To LMR
With Range("A" & ip)
If .Value = ComboBox2.Value Then
.Offset(, 1).Resize(, 26).Copy
Range("AE" & Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues
End If
End With
Next ip


Code:
Range("AE" & Rows.Count).End(xlUp).Offset(2).Value = " "
Vog, after the above code is there any possibilty to take the sub totals into the next row?
Thanks
 
Upvote 0

Forum statistics

Threads
1,225,156
Messages
6,183,233
Members
453,152
Latest member
ChrisMd

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