Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Use InStr function in formula? | Excel Worksheet Functions | |||
Len and InStr problem manipulating strings | Excel Programming | |||
Problem using the INSTR function in VBA | Excel Programming | |||
InStr | Excel Programming | |||
Instr function problem | Excel Programming |