Cole Patzman
Dec 11th, 2003, 11:55 AM
I'm in VBA and what I am trying to do is to see if the value of "FF" is contained in the text of a cell. The instr() function works fine and comes out with the position. But when I want to delete that value from the cell, or memory variable, I get an error with Mid( highlighted and the error message is wrong number of arguments, or invalid property assignment. The following is the code:
Dim pc As String
Dim ppc As Integer
pc = "FF"
Range("r" & row).Select
Selection.Interior.ColorIndex = 35 'green
If Not IsNumeric(Selection.Text) Then
ppc = InStr(Selection.Text, pc) 'this works fine
Dim positio As String
positio = Selection.Text 'this works fine
While ppc <> 0
positio = Mid(positio, 1, (ppc - 1) & positio, ppc + 2) '
ppc = InStr(Selection.Text, pc)
Wend
endif
Thanks in advance,
Cole
:(
Dim pc As String
Dim ppc As Integer
pc = "FF"
Range("r" & row).Select
Selection.Interior.ColorIndex = 35 'green
If Not IsNumeric(Selection.Text) Then
ppc = InStr(Selection.Text, pc) 'this works fine
Dim positio As String
positio = Selection.Text 'this works fine
While ppc <> 0
positio = Mid(positio, 1, (ppc - 1) & positio, ppc + 2) '
ppc = InStr(Selection.Text, pc)
Wend
endif
Thanks in advance,
Cole
:(