Filling cell with lowercase "true" and "false" without an apostrophe

flatman

New Member
Joined
Sep 5, 2014
Messages
2
What's the equivalent to this in VBA?
=Lower("TRUE")
Copy -> paste_special -> Values

The above gives me the lowercase value "true" in the cell without a leading apostrophe.

I tried a bunch of things in VBA including:
Range("A1").Value = LCase("TRUE")

But each time the result ends up uppercase. Adding an apostrophe is not a solution for me as I the 3rd party tool that reads my resulting excel file does not like uppercase and it does not like the leading apostrophe.

Thanks!
 

Rick Rothstein

MrExcel MVP
Joined
Apr 18, 2011
Messages
35,498
Office Version
2010
Platform
Windows
This seems to work...

Code:
Range("A1").NumberFormat = "@"
Range("A1").Value = "true"
 

WarPigl3t

Well-known Member
Joined
May 25, 2014
Messages
1,599
I don't know what you mean by leading apostrophe. Try puting the word "TRUE" in a variable and instanciate the variable as a string first.
Dim var as string
var = "TRUE"
Range("A1").value = LCase(var)
 

Scott Huish

MrExcel MVP
Joined
Mar 17, 2004
Messages
19,880
If you put a leading apostrophe before a value in Excel, it makes it TEXT and the reason you would do that is because TRUE and FALSE are boolean values that Excel displays in uppercase.
WarPiglet, your solution will not work unless you make the cell in text format like Rick did.
 

Peter Thompson

Active Member
Joined
Dec 15, 2008
Messages
262
Not sure why lcase isn't working for you there are a couple of things you could try. I would try assigning "TRUE" to a string variable and then apply the lcase function to this variable and see if it makes any difference. Alternatively you could get excel to insert a column next to the column containing the values you want to make lowercase and then getting vba to put a formula using the lower function in this column before making this column values and deleting the column with the original upper case entries.
 

Forum statistics

Threads
1,081,543
Messages
5,359,431
Members
400,526
Latest member
Brook1083

Some videos you may like

This Week's Hot Topics

  • VBA (Userform)
    Hi All, I just would like to know why my code isn't working. Here is my VBA code: [CODE=vba]Private Sub OKButton_Click() Dim i As Integer...
  • List box that changes fill color
    Hello, I have gone through so many pages trying to figure this out. I have a 2020 calendar that depending on the day needs to have a certain...
  • Remove duplicates and retain one. Cross-linked cases
    Hi all I ran out of google keywords to use and still couldn't find a reference how to achieve the results of a single count. It would be great if...
  • VBA Copy and Paste With Duplicates
    Hello All, I'm in need of some input. My VBA skills are sub-par at best. I've assembled this code from basic research and it works but is...
  • Macro
    is it possible for a macro to run if the active cell value is different to the value above it
  • IF DATE and TIME
    I currently use this to check if date has passed but i also need to set a time on it too. Is it possible? [CODE=vba]=IF(B:B>TODAY(),"Not...
Top