strange this is working 
Author Message
 strange this is working

Hi all

By coincident I found that this subs are working.
It is strange because the upper and lower don't work and the proper does.
ltrim not and trim does??

Are there more things like this???

Regards Ron

Sub a()
Selection.Value = Application.Trim(Selection.Value)
End Sub

Sub b()
Selection.Value = Application.Proper(Selection.Value)
End Sub

Sub c()
Selection.Value = Application.Dollar(Selection.Value)
End Sub



Thu, 08 Jul 2004 04:19:13 GMT  
 strange this is working
If you look in the help for worksheetfunctions available in VBA, you'll see that
the 3 you mention are all available in VBA.

But Upper/lower are not.  Maybe because VBA has it's own Ucase and LCase
functions (along with strconv) that do the same thing (except that they all act
on one item).

Trim also is in both VBA and excel proper, but it does slightly different things
(The worksheet function removes consecutive spaces within the string, while the
vba function does not.)

===
But to your bigger point, it would be nice to be able to do things like:

        selection.value = Ucase(selection.value)
        or
        selection = ucase(selection)

for ranges with more than one cell.

I don't have an answer why it doesn't work.

Quote:

> Hi all

> By coincident I found that this subs are working.
> It is strange because the upper and lower don't work and the proper does.
> ltrim not and trim does??

> Are there more things like this???

> Regards Ron

> Sub a()
> Selection.Value = Application.Trim(Selection.Value)
> End Sub

> Sub b()
> Selection.Value = Application.Proper(Selection.Value)
> End Sub

> Sub c()
> Selection.Value = Application.Dollar(Selection.Value)
> End Sub

--

Dave Peterson



Thu, 08 Jul 2004 05:14:19 GMT  
 strange this is working
Hi Ron,

Proper and Trim are worksheet functions available for VBA and upper, lower
and Ltrim not for this you have Ucase, LCase and Ltrim VBA functions.

Selection.Value = Ucase(Selection.Value)
Selection.Value = Lcase(Selection.Value)
Selection.Value = Ltrim(Selection.Value)

HTH



Quote:
> Hi all

> By coincident I found that this subs are working.
> It is strange because the upper and lower don't work and the proper does.
> ltrim not and trim does??

> Are there more things like this???

> Regards Ron

> Sub a()
> Selection.Value = Application.Trim(Selection.Value)
> End Sub

> Sub b()
> Selection.Value = Application.Proper(Selection.Value)
> End Sub

> Sub c()
> Selection.Value = Application.Dollar(Selection.Value)
> End Sub



Thu, 08 Jul 2004 06:08:43 GMT  
 strange this is working
I try this already Orlando

but give me a error ( error 13)

Do you now why



Quote:
> Hi Ron,

> Proper and Trim are worksheet functions available for VBA and upper, lower
> and Ltrim not for this you have Ucase, LCase and Ltrim VBA functions.

> Selection.Value = Ucase(Selection.Value)
> Selection.Value = Lcase(Selection.Value)
> Selection.Value = Ltrim(Selection.Value)

> HTH



> > Hi all

> > By coincident I found that this subs are working.
> > It is strange because the upper and lower don't work and the proper
does.
> > ltrim not and trim does??

> > Are there more things like this???

> > Regards Ron

> > Sub a()
> > Selection.Value = Application.Trim(Selection.Value)
> > End Sub

> > Sub b()
> > Selection.Value = Application.Proper(Selection.Value)
> > End Sub

> > Sub c()
> > Selection.Value = Application.Dollar(Selection.Value)
> > End Sub



Thu, 08 Jul 2004 07:00:55 GMT  
 strange this is working
Your selection contained more than one cell.

Quote:

> I try this already Orlando

> but give me a error ( error 13)

> Do you now why



> > Hi Ron,

> > Proper and Trim are worksheet functions available for VBA and upper, lower
> > and Ltrim not for this you have Ucase, LCase and Ltrim VBA functions.

> > Selection.Value = Ucase(Selection.Value)
> > Selection.Value = Lcase(Selection.Value)
> > Selection.Value = Ltrim(Selection.Value)

> > HTH



> > > Hi all

> > > By coincident I found that this subs are working.
> > > It is strange because the upper and lower don't work and the proper
> does.
> > > ltrim not and trim does??

> > > Are there more things like this???

> > > Regards Ron

> > > Sub a()
> > > Selection.Value = Application.Trim(Selection.Value)
> > > End Sub

> > > Sub b()
> > > Selection.Value = Application.Proper(Selection.Value)
> > > End Sub

> > > Sub c()
> > > Selection.Value = Application.Dollar(Selection.Value)
> > > End Sub

--

Dave Peterson



Thu, 08 Jul 2004 09:14:38 GMT  
 strange this is working
yes I now Dave

So it is not the same Orlando posted

Selection.Value = Application.Proper(Selection.Value)
will work on more then one cell

Regards Ron


Quote:
> Your selection contained more than one cell.


> > I try this already Orlando

> > but give me a error ( error 13)

> > Do you now why



> > > Hi Ron,

> > > Proper and Trim are worksheet functions available for VBA and upper,
lower
> > > and Ltrim not for this you have Ucase, LCase and Ltrim VBA functions.

> > > Selection.Value = Ucase(Selection.Value)
> > > Selection.Value = Lcase(Selection.Value)
> > > Selection.Value = Ltrim(Selection.Value)

> > > HTH



> > > > Hi all

> > > > By coincident I found that this subs are working.
> > > > It is strange because the upper and lower don't work and the proper
> > does.
> > > > ltrim not and trim does??

> > > > Are there more things like this???

> > > > Regards Ron

> > > > Sub a()
> > > > Selection.Value = Application.Trim(Selection.Value)
> > > > End Sub

> > > > Sub b()
> > > > Selection.Value = Application.Proper(Selection.Value)
> > > > End Sub

> > > > Sub c()
> > > > Selection.Value = Application.Dollar(Selection.Value)
> > > > End Sub

> --

> Dave Peterson




Thu, 08 Jul 2004 17:34:50 GMT  
 strange this is working
Orlando's formula used the VBA functions.  It sure looks like the worksheet
function is more useful(?) when converting a multi-cell range.  But not all
worksheet functions work inside VBA.  

This looks to me like one of those things I'll kind of remember.  I'll have to
try it each time I use it to see which ones work what way.

Quote:

> yes I now Dave

> So it is not the same Orlando posted

> Selection.Value = Application.Proper(Selection.Value)
> will work on more then one cell

> Regards Ron



> > Your selection contained more than one cell.


> > > I try this already Orlando

> > > but give me a error ( error 13)

> > > Do you now why



> > > > Hi Ron,

> > > > Proper and Trim are worksheet functions available for VBA and upper,
> lower
> > > > and Ltrim not for this you have Ucase, LCase and Ltrim VBA functions.

> > > > Selection.Value = Ucase(Selection.Value)
> > > > Selection.Value = Lcase(Selection.Value)
> > > > Selection.Value = Ltrim(Selection.Value)

> > > > HTH



> > > > > Hi all

> > > > > By coincident I found that this subs are working.
> > > > > It is strange because the upper and lower don't work and the proper
> > > does.
> > > > > ltrim not and trim does??

> > > > > Are there more things like this???

> > > > > Regards Ron

> > > > > Sub a()
> > > > > Selection.Value = Application.Trim(Selection.Value)
> > > > > End Sub

> > > > > Sub b()
> > > > > Selection.Value = Application.Proper(Selection.Value)
> > > > > End Sub

> > > > > Sub c()
> > > > > Selection.Value = Application.Dollar(Selection.Value)
> > > > > End Sub

> > --

> > Dave Peterson


--

Dave Peterson



Thu, 08 Jul 2004 22:34:26 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. I am recieving strange e-mails

2. Strange strange strange

3. Reminder Does Not Work For Some Appointments Where I am Invitee

4. XL97: which directory am I working in?

5. I need help, I am on a network and access is not working

6. Project I am working on.

7. Archive mail not working - I am stumped!

8. Am I working within the right type

9. AM/PM Not Working

10. I am working with reports with 2 tables, Same DB


 
Powered by phpBB® Forum Software © phpBB Group