[RESOLVED] Using Replace function in a mshflexgrid
Keep getting an error trying to replace part of a string in a msflexgrid:
The code that does not work:
TextToReplace = "price adjusted for sales commission (.911)"
For r = 1 To GridMisc.Rows - 1
With Me.GridMisc
If InStr(LCase(.TextMatrix(r, 2)), TextToReplace) Then
.TextMatrix(r, 2) = .TextMatrix(r, 2) & Replace(TextToReplace, "")
End If
End With
Next
Typical string in grid:
Software sold RoofCalculator 8.3 Michael C Douglass price adjusted for sales commission (.911)
just trying to erase all after the name
Re: Using Replace function in a mshflexgrid
Code:
Dim r&, TextToReplace$, sTextMatrix$
TextToReplace = " price adjusted for sales commission (.911)"
With GridMisc
For r = 1& To .Rows - 1&
sTextMatrix = .TextMatrix(r, 2&)
If InStr(1&, sTextMatrix, TextToReplace, vbTextCompare) Then
.TextMatrix(r, 2&) = Replace(sTextMatrix, TextToReplace, vbNullString)
End If
Next
End With
Re: Using Replace function in a mshflexgrid
Re: Using Replace function in a mshflexgrid
u wanna mark this as Resolved?