Lcase error

davidam

Active Member
Joined
May 28, 2010
Messages
497
Office Version
  1. 2021
Platform
  1. Windows
This seems ridiculously simple, but I cannot make this work:
Code:
Public Sub Lcase()
Dim caseStr As String
caseStr = Range("F3").Value
Range("A10").Value = Lcase(caseStr)
End Sub
Thanks!
It highlights the expression Lcase, and says wrong # arg or invalid prop assignment
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Don't name your sub after a built in VBA function..

Change
Public Sub Lcase()

to
Public Sub MyLcase()

Hope that helps.
 
Last edited:
Upvote 0
davidam,

You can not use a VBA Function as the name of your Sub.

Try:

Code:
Public Sub MyLcase()
Dim caseStr As String
caseStr = Range("F3").Value
Range("A10").Value = Lcase(caseStr)
End Sub
 
Upvote 0
Might I ask why not just use this formula?

=LOWER(F3)
 
Upvote 0
While I also think that if you are using this directly in the spreadsheet you my as well use the built in function LOWER.

However, I would like to comment on your code. You use 2 lines to declare and assign a value to a variable. If that's all you're doing it with it, I would discard that and reduce the whole thing to 1 line of code:

Code:
Sub MyLcase()
Range("A10") = LCase(Range("F3"))
End Sub
 
Upvote 0
You are both correct for sure. I am using this function is a vb script and I was have trouble with it, so this, with the variables etc, was just for my edification. Many thanks to all for the input; it is appreciated!
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,706
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top