Thread: Type Mismatch
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Type Mismatch

I like to use application.match()

dim res as variant
with worksheets("sheet1")
res = Application.match(.Cells(i, 2), _
wipwkbk.Worksheets("Live").Range("b1:b18"), 0)

if iserror(res) then
'what should happen
else
if isnumeric(res) then
if res 0 then
.cells(i,1).entirerow.copy _
Destination:=Worksheets("Sheet7").Cells(j,1)
else
'do nothing???
end if
else
'do nothing
end if
end if
end with

teresa wrote:

I get a type mismatch with the first code and still doesnt run with second,
clearly missing something, help is much appreciated

with worksheets("sheet1")
If Application.match(.Cells(i, 2),
wipwkbk.Worksheets("Live").Range("b1:b18"), 0) 0 Then
.Cells(i, 1).EntireRow.Copy
Destination:=Worksheets("Sheet7").Cells(j,1)

OR

with worksheets("sheet1")
If Application.match(.Cells(i, 2),
wipwkbk.Worksheets("Live").Range("b1:b18"), 0) Then
.Cells(i, 1).EntireRow.Copy Destination:=Worksheets("Sheet7").Cells(j,1)


--

Dave Peterson