ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   instr problem with formula (https://www.excelbanter.com/excel-programming/437876-instr-problem-formula.html)

Shell

instr problem with formula
 
I am trying to use the following

If InStr(1, "C:\", Range(strC & r).Formula) 0 Then
Print #1, r & strC & " " & " " & Range(strC & r).Formula
End If

strC = D
r = 21
Range(strC & r).Formula = "=(ISERROR(GET
PIVOTDATA("EQPSERIAL",'C:\Reports..........."

The print statement never happens.

Can anyone tell me what is wrong?

Thanks
--
Shell

Dave Peterson

instr problem with formula
 
There's another argument you can specify to make sure you don't have to worry
about upper/lower case.

vbTextCompare

Check VBA's help for instr and you'll see more info.

Maybe it's c:\ in the formula???

Or maybe you're looking at the wrong cell?

Shell wrote:

I am trying to use the following

If InStr(1, "C:\", Range(strC & r).Formula) 0 Then
Print #1, r & strC & " " & " " & Range(strC & r).Formula
End If

strC = D
r = 21
Range(strC & r).Formula = "=(ISERROR(GET
PIVOTDATA("EQPSERIAL",'C:\Reports..........."

The print statement never happens.

Can anyone tell me what is wrong?

Thanks
--
Shell


--

Dave Peterson

Rick Rothstein

instr problem with formula
 
Your syntax on the InStr function is incomplete... as constructed, your
statement is looking for this...

"C:\", Range(strC & r).Formula

inside the string value of 1 (VB converts your number to a string). Why,
because you only specified two arguments to the InStr function. The first
argument is optional... it is the starting point for the search and defaults
to 1 when not specified. If you specify the starting position as a number,
then it must be followed by two string argument... the string to search
followed by the string being looked for. I can't give you a corrected
statement for you to look at because you didn't tell us what string you were
looking for inside of that path string.

--
Rick (MVP - Excel)


"Shell" wrote in message
...
I am trying to use the following

If InStr(1, "C:\", Range(strC & r).Formula) 0 Then
Print #1, r & strC & " " & " " & Range(strC & r).Formula
End If

strC = D
r = 21
Range(strC & r).Formula = "=(ISERROR(GET
PIVOTDATA("EQPSERIAL",'C:\Reports..........."

The print statement never happens.

Can anyone tell me what is wrong?

Thanks
--
Shell



Shell

instr problem with formula
 
I solved it.
--
Shell


"Shell" wrote:

I am trying to use the following

If InStr(1, "C:\", Range(strC & r).Formula) 0 Then
Print #1, r & strC & " " & " " & Range(strC & r).Formula
End If

strC = D
r = 21
Range(strC & r).Formula = "=(ISERROR(GET
PIVOTDATA("EQPSERIAL",'C:\Reports..........."

The print statement never happens.

Can anyone tell me what is wrong?

Thanks
--
Shell



All times are GMT +1. The time now is 12:29 AM.

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