View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Tim is offline
external usenet poster
 
Posts: 408
Default run time error 13

Same as previous post

"Tim" wrote:

Giving run time error 13 on line pos = InStr(sStr, "-")
anyone know the problem with the code

Sub Macro6()
'
' Macro6 Macro
' Macro recorded 10/1/2004 by Husky User
'

Dim sStr As String
Dim pos As Long
Dim i As Long
Dim j As Long
Windows("LL-CP-0163.xls").Activate
Range("J2").Select //J2 =
LL-CP-0163
sStr = "J2" // Set
sTtr to LL-CP-0163
pos = InStr(sStr, "-") // find -
before 0163
i = Mid(sStr, pos + 1) + 1 // set i =
0163 + 1=164
j = i - 1 // j=163
MsgBox i
MsgBox j
Range("F" & i).Select
End Sub