ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   problem with excel invalid procedure call (https://www.excelbanter.com/excel-programming/374835-problem-excel-invalid-procedure-call.html)

[email protected]

problem with excel invalid procedure call
 
Hi,

Here is the following snippet of code that is giving me a problem:

If Sheet2.Cells(i, 3).Value = group Then
If InStr(0, output, Sheet2.Cells(i, 4)) = 0 Then
output = output & Sheet2.Cells(i, 4) & ": " &
Sheet2.Cells(i, 11) & "lbs" & vbNewLine
End If
End If


The error likes in the "If InStr..." line. On the SECOND time it
iterates and hits this, I am getting an Invalid Procedure Call or
Argument error. Ive tried using the textual comparison 4th argument and
still no luck. Is the syntax of the InStr() function off here? Any help
would be greatly appreciated.

by the way, 'output', 'group' are both strings.


Mike


NickHK

problem with excel invalid procedure call
 
Mike,
InStr is based on starting at chr #1. Hence "0" is not possible.

NickHK

wrote in message
oups.com...
Hi,

Here is the following snippet of code that is giving me a problem:

If Sheet2.Cells(i, 3).Value = group Then
If InStr(0, output, Sheet2.Cells(i, 4)) = 0 Then
output = output & Sheet2.Cells(i, 4) & ": " &
Sheet2.Cells(i, 11) & "lbs" & vbNewLine
End If
End If


The error likes in the "If InStr..." line. On the SECOND time it
iterates and hits this, I am getting an Invalid Procedure Call or
Argument error. Ive tried using the textual comparison 4th argument and
still no luck. Is the syntax of the InStr() function off here? Any help
would be greatly appreciated.

by the way, 'output', 'group' are both strings.


Mike





All times are GMT +1. The time now is 11:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com