ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Convert to Lower case (not with a function) (https://www.excelbanter.com/excel-worksheet-functions/8394-convert-lower-case-not-function.html)

TAJ Simmons

Convert to Lower case (not with a function)
 
Excel XP/2002

Is there a quick button I can add to a custom toolbar to convert a selected cell to lower case?

I've searched the customize toolbar menu items but cannot find it. Sure excel has one? (even powerpoint has one!)

Unfortunately a 'function' to convert the data is no use to me this time.

Cheers
TAJ Simmons
microsoft powerpoint mvp

awesome - powerpoint backgrounds,
free powerpoint templates, tutorials, hints and tips etc
http://www.powerpointbackgrounds.com



Bob Phillips

TAJ,

You will need to create your own.

Below is a sub that you can add to a standard code module in your
Personal.xls and it will convert the selected cells. It has 2 options,
normal click for lower case, shift-click for upper case

You will also need to add the button to a toolbar, this code can do that

Dim oCtl As CommandBarControl

With
Application.CommandBars("Formatting").Controls.Add (Type:=msoControlButton)
.Caption = "Change Case"
.FaceId = 254
.OnAction = "ChangeCase"
End With

This adds a button with a small A (not lower case) and a big A, which seems
appropriate enough.

Here is the case change routine.

Option Explicit

Declare Function GetKeyState Lib "user32" (ByVal fnKey As Long) As Integer

Const vkShift As Integer = &H10

Sub ChangeCase()
Dim cell As Range
For Each cell In Selection
If GetKeyState(vkShift) < 0 Then
cell.Value = UCase(cell.Value)
Else
cell.Value = LCase(cell.Value)
End If
Next cell
End Sub

--

HTH

RP
(remove nothere from the email address if mailing direct)


"TAJ Simmons" wrote in message
...
Excel XP/2002

Is there a quick button I can add to a custom toolbar to convert a

selected cell to lower case?

I've searched the customize toolbar menu items but cannot find it. Sure

excel has one? (even powerpoint has one!)

Unfortunately a 'function' to convert the data is no use to me this time.

Cheers
TAJ Simmons
microsoft powerpoint mvp

awesome - powerpoint backgrounds,
free powerpoint templates, tutorials, hints and tips etc
http://www.powerpointbackgrounds.com





TAJ Simmons

Thanks Bob




All times are GMT +1. The time now is 07:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com