View Single Post
  #15   Report Post  
jerrycollins6 jerrycollins6 is offline
Junior Member
 
Posts: 13
Default

Quote:
Originally Posted by Ben McClave View Post
Hi Jerry,

Unless I set up my test workbook differently than yours, the code seems to work fine. I think that the problem probably lies in the variables. There are only three variables to feed the code. They are found near the top:

'Assign variables
Set ws = ThisWorkbook.Sheets("ICD")
Set rFind = ws.Range("A1:A100")
sFind = ThisWorkbook.Sheets("HOME").Range("A1").Value

When the code runs, it will search:

(1) Within the "ws" sheet
(2) In the "rFind" range
(3) for the text value assigned to "sFind"

I assumed that the worksheet containing data to copy ("ws") is the sheet called "ICD", and that the range of values to search ("rFind") is in the range A1:A100 of the "ICD" sheet. I further assumed that the text we're searching for ("sFind") can be found in cell A1 of the "HOME" tab. If one of these variables is off, the code may not react as expected.

If the variables have been set correctly, please consider posting a sample version of your workbook so that I can take a look at how the code interacts with your data set.

Ben
ok I've found what the problem is.

in the sheet home, in cell A1 ,I have a combo box where I can choose the words from the list.
but bellow the combo box, still in A1, on the right, it gives a number according to the word. for example if I choose customer, it says 1 then 2 or 3 for the others.

the code, doesn't look for the names it looks for the number. that's why it doesn t work properly.