![]() |
VBA Proper Case Code
Hello! I wrote this simple code to change the case in a cell to proper when a macro button is pushed, but it doesn't work. I don't get any errors, but when I run the macro, the screen just blinks like something is happening, but I don't know what? Where's the problem? Sub CaseChange() Formula = "Proper(A1)" End Sub Thanks, EMoe -- EMoe ------------------------------------------------------------------------ EMoe's Profile: http://www.excelforum.com/member.php...o&userid=23183 View this thread: http://www.excelforum.com/showthread...hreadid=373999 |
VBA Proper Case Code
You haven't refenced a cell. All that code will do is place the string "Proper(A1)" in the variable Formula. Perhaps something like this? Code: -------------------- Sub MakeProper() ActiveCell = WorksheetFunction.Proper(ActiveCell.Value) End Sub -------------------- -- Norie ------------------------------------------------------------------------ Norie's Profile: http://www.excelforum.com/member.php...o&userid=19362 View this thread: http://www.excelforum.com/showthread...hreadid=373999 |
VBA Proper Case Code
This works fine. But what if I wanted to change all the text in a range of cells e.g from A1 to A30? EMo -- EMo ----------------------------------------------------------------------- EMoe's Profile: http://www.excelforum.com/member.php...fo&userid=2318 View this thread: http://www.excelforum.com/showthread.php?threadid=37399 |
VBA Proper Case Code
You might want to take a look at
http://www.mvps.org/dmcritchie/excel/proper.htm as a macro would normally work with a selection chosen before running the macro. --- HTH, David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001] My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm Search Page: http://www.mvps.org/dmcritchie/excel/search.htm "Norie" wrote in message ... You haven't refenced a cell. All that code will do is place the string "Proper(A1)" in the variable Formula. Perhaps something like this? Code: -------------------- Sub MakeProper() ActiveCell = WorksheetFunction.Proper(ActiveCell.Value) End Sub -------------------- -- Norie ------------------------------------------------------------------------ Norie's Profile: http://www.excelforum.com/member.php...o&userid=19362 View this thread: http://www.excelforum.com/showthread...hreadid=373999 |
VBA Proper Case Code
You would need to loop through each cell in the range Code: -------------------- Sub MakeProperRange() Dim c As Range For Each c In Range("A1:A30" cl = WorksheetFunction.Proper(c.Value) Next c End Sub -------------------- -- Norie ------------------------------------------------------------------------ Norie's Profile: http://www.excelforum.com/member.php...o&userid=19362 View this thread: http://www.excelforum.com/showthread...hreadid=373999 |
All times are GMT +1. The time now is 05:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com