Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Running the below sub caused a compile error: Variable not defined.
The "Cell ref =" portion of the fourth line is highlighted. What would the correction be? Thanks, Phil Sub CountCharacters() Dim StrinLen As Integer Dim EmptySpaces As Integer Dim I As Integer CellRef = Trim(ActiveCell.Value) StrinLen = Len(ActiveCell.Value) For I = 1 To Len(ActiveCell.Value) If Mid(CellRef, I, 1) = " " Then EmptySpaces = EmptySpaces + 1 Next MsgBox "String Lengh: " & StrinLen & Chr(10) & "Empty Spaces: " & EmptySpaces Dim StrinLen As Integer End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim StrinLen As Integer
Dim EmptySpaces As Integer Dim I As Integer Dim CellRef as Variant -- Regards, Tom Ogilvy "Phil Hageman" wrote in message ... Running the below sub caused a compile error: Variable not defined. The "Cell ref =" portion of the fourth line is highlighted. What would the correction be? Thanks, Phil Sub CountCharacters() Dim StrinLen As Integer Dim EmptySpaces As Integer Dim I As Integer CellRef = Trim(ActiveCell.Value) StrinLen = Len(ActiveCell.Value) For I = 1 To Len(ActiveCell.Value) If Mid(CellRef, I, 1) = " " Then EmptySpaces = EmptySpaces + 1 Next MsgBox "String Lengh: " & StrinLen & Chr(10) & "Empty Spaces: " & EmptySpaces Dim StrinLen As Integer End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks, Tom - works great.
Tom, if you have time, could you look at my post of 6/6 concerning the hyperlink - trying to put some polish on an application. Thanks, Phil "Tom Ogilvy" wrote: Dim StrinLen As Integer Dim EmptySpaces As Integer Dim I As Integer Dim CellRef as Variant -- Regards, Tom Ogilvy "Phil Hageman" wrote in message ... Running the below sub caused a compile error: Variable not defined. The "Cell ref =" portion of the fourth line is highlighted. What would the correction be? Thanks, Phil Sub CountCharacters() Dim StrinLen As Integer Dim EmptySpaces As Integer Dim I As Integer CellRef = Trim(ActiveCell.Value) StrinLen = Len(ActiveCell.Value) For I = 1 To Len(ActiveCell.Value) If Mid(CellRef, I, 1) = " " Then EmptySpaces = EmptySpaces + 1 Next MsgBox "String Lengh: " & StrinLen & Chr(10) & "Empty Spaces: " & EmptySpaces Dim StrinLen As Integer End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Solver - error - Compile Error | Excel Discussion (Misc queries) | |||
help with this error-Compile error: cant find project or library | Excel Discussion (Misc queries) | |||
How do I get rid of "Compile error in hidden module" error message | Excel Discussion (Misc queries) | |||
Compile error in hidden module error | Excel Programming |