ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   type mismatch (https://www.excelbanter.com/excel-programming/418305-type-mismatch.html)

geebee

type mismatch
 
hi,

i have the following:

Dim NEWFILE As String
NEWFILE = Range("C" & x).Value
....
Dim test As String
test = Evaluate("LEFT(NEWFILE,FIND(""_"", NEWFILE ,1)-1)")

not sure what is wrong with the syntax

thanks in advance,
geebee



Mike

type mismatch
 
Try this
NEWFILE = "" & Range("C" & x).Value & ""

"geebee" wrote:

hi,

i have the following:

Dim NEWFILE As String
NEWFILE = Range("C" & x).Value
...
Dim test As String
test = Evaluate("LEFT(NEWFILE,FIND(""_"", NEWFILE ,1)-1)")

not sure what is wrong with the syntax

thanks in advance,
geebee



geebee

type mismatch
 
hi,

i tried:

Dim NEWFILE As String
NEWFILE = "" & Range("C" & x).Value & ""

Dim test As String
test = Evaluate("LEFT(" & NEWFILE & ",FIND(""_""," & NEWFILE & ",1)-1)")
..


still getting same error message

"Mike" wrote:

Try this
NEWFILE = "" & Range("C" & x).Value & ""

"geebee" wrote:

hi,

i have the following:

Dim NEWFILE As String
NEWFILE = Range("C" & x).Value
...
Dim test As String
test = Evaluate("LEFT(NEWFILE,FIND(""_"", NEWFILE ,1)-1)")

not sure what is wrong with the syntax

thanks in advance,
geebee



Dave Peterson

type mismatch
 
What's in that cell?

What are your trying to accomplish?

VBA has its own left() function and it can use inStr() to inspect strings.

geebee wrote:

hi,

i have the following:

Dim NEWFILE As String
NEWFILE = Range("C" & x).Value
...
Dim test As String
test = Evaluate("LEFT(NEWFILE,FIND(""_"", NEWFILE ,1)-1)")

not sure what is wrong with the syntax

thanks in advance,
geebee


--

Dave Peterson


All times are GMT +1. The time now is 03:49 AM.

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