-
Jan 30th, 2015, 05:05 PM
#1
Thread Starter
PowerPoster
[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
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders
-
Jan 30th, 2015, 05:14 PM
#2
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
Last edited by Bonnie West; Jan 30th, 2015 at 05:33 PM.
Reason: Rearranged code snippet for efficiency
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)
-
Jan 30th, 2015, 05:32 PM
#3
Thread Starter
PowerPoster
Re: Using Replace function in a mshflexgrid
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders
-
Jan 30th, 2015, 05:50 PM
#4
Re: Using Replace function in a mshflexgrid
u wanna mark this as Resolved?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|