[RESOLVED] Corect runtime error in matching columns
Hello guys I have got following code,
the code check column A and B in sheet1 then match them with sheet2 A and B,
Sheet1
Sheet2
if column A and B sheet1 match column a and B in sheet2,
take the matching cell in this result,
sheet 1 same row column J the value * the value in column G same row sheet2,
but if there are cells in sheet1 and column A and B that not exists in Sheet2,
while the code ran without error i am not sure it would matching correctly, a single run matches the following rows
1 1
1 6
6 1
6 6
though mystring always gets its value from sheet2 at the current row in sheet1, which is probably not the desired result
as you have already set worksheet objects, you should avoid going back to the individual sheets, just work with the objects
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case. Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Most likely, when you thought that you deleted a value, you typed a " " instead of hitting the delete key. This is the peril of freely treating text and numbers as the same thing. If you must, then at least perform a IsNumeric(var) check before performing any numeric computations with the value.