Copy from a worksheet

Darren Smith

Well-known Member
Joined
Nov 23, 2020
Messages
631
Office Version
  1. 2019
Platform
  1. Windows
Trying to find a value in source sheet data column then copy a range to dest sheet data & paste the range to destination worksheet offset 1 column over.
It can`t find the Value Electric in both sheets by the looks??

Sub Tippa_Electric_Wires()


Dim wsSource As Worksheet, wsDest As Worksheet
Dim QDetails As ComboBox
Dim i As Long, rng As Long
Dim Addme As Range, RngSource As Range, RngDest As Range


Set wsSource = ThisWorkbook.Worksheets("Part_Group_Items_ List")
Set wsDest = ThisWorkbook.Worksheets("Job Card Master")
Set QDetails = Body_And_Vehicle_Type_Form.Quote_Details

With wsSource.Range("D:D")
Set RngSource = .Find("ELECTRICS", , xlValues, xlPart)
End With

With wsDest
Set RngDest = .Find("ELECTRICS", , xlValues, xlPart)
Set Addme = RngDest.Offset(0, 5)
End With

For i = 0 To QDetails.ListCount - 1
If QDetails.Selected(i) Then

If QDetails_Details.List(i, 1) = ("Boxer") & "" & QDetails_Details.List(i, 4) = ("L2") & "" & QDetails_Details.List(i, 2) = ("Single") Then
wsSource.RngSource("A72:O78").Copy Destination:=Addme
End If
End If

End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
It does not seem to like 2 x Finds in the code how could I get over this?
 
Upvote 0
how do you know and/or why do you say "It does not seem to like 2 x Finds in the code" ?

You say It can`t find the Value Electric, so why does the code try finding ELECTRICS instead of Electric ?

Using the file you linked to on May 26 over at that other site:

Doing a manual Ctrl+F to find a partial match for ELECTRICS on the whole of both sheets.
There is only one... at C41 of "Job Card Master", none on "Part_Group_Items_List"

Doing a manual Ctrl+F to find a partial match for Electric (which you say is the value you're trying to find)
There are two on "Job Card Master" ... at N5 and C41
and six on "Part_Group_Items_List" ... E8, E13, E33, E38, E43, and E49
 
Upvote 0

Forum statistics

Threads
1,214,386
Messages
6,119,215
Members
448,874
Latest member
b1step2far

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