|
-
May 4th, 2006, 11:02 AM
#1
Thread Starter
Lively Member
[Resolved]Convert Substitute to VBA Code
What would this be in VBA code?
If Len(Trim(rngGridCell)) - Len(Substitute(rngGridCell, " ", "")) + 1 < 28 Then
When I try to run it like that it tells me "sub or Function not defined"
Thanks!
Last edited by gtg689a; May 4th, 2006 at 12:23 PM.
-
May 4th, 2006, 11:05 AM
#2
Re: Convert Substitute to VBA Code
you need the REPLACE function.
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
May 4th, 2006, 11:10 AM
#3
Thread Starter
Lively Member
Re: Convert Substitute to VBA Code
Idon't think that will work, I want to first count the length of the charachters in the cell, then i want to remove all of the blank spaces and subtract that by the original length.
that would give me how many names were in the cell.
I need to be able to replace specific instances (ie. " " with ""), I don't think replace lets me do that?
-
May 4th, 2006, 11:14 AM
#4
Re: Convert Substitute to VBA Code
Yes, it will let you do that. Here's an example.
VB Code:
Sub SampleReplace()
Dim sInput As String
Dim sOutput As String
sInput = "This is a Test"
sOutput = Replace(sInput, " ", "")
MsgBox sOutput
End Sub
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
May 4th, 2006, 11:19 AM
#5
Thread Starter
Lively Member
Re: Convert Substitute to VBA Code
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
|