Thread: Excel Macro
View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Shane Devenshire[_2_] Shane Devenshire[_2_] is offline
external usenet poster
 
Posts: 3,346
Default Excel Macro

Hi,

1. Choose Tools, Customize, Commands tab, Macros category, drag the Custom
Button on to any toolbar.
2. With the Customize dialog box open right-click the new button and choose
Assign Macro and pick ChangeCase_Show().

I might also add a shortcut key for the macro, and change the button Name
and Picture, but they are not necessary.

I would also modify your code to read:

Option Explicit
Dim Cell As Range

Sub ChangeCase_Show()
frmCase.Show
End Sub

Sub DoCaseChange()
If frmCase.optLower = True Then
LowerCase
ElseIf frmCase.optUpper = True Then
UpperCase
Else
TitleCase
End If
End Sub

Sub LowerCase()
For Each Cell In Selection
Cell = LCase(Cell)
Next Cell
End Sub

Sub UpperCase()
For Each Cell In Selection
Cell = UCase(Cell)
Next Cell
End Sub

Sub TitleCase()
For Each Cell In Selection
Cell = Application.Proper(Cell)
Next Cell
End Sub

--
If this helps, please click the Yes button.

Cheers,
Shane Devenshire


"Val H" wrote:

I have a set of macros which Changes the case within Excel. This is in my
Personal.xls workbook which is hidden, so the macro won't run

The macro is as follows

Option Explicit
Dim objCell As Object


Sub ChangeCase_Show()
frmCase.Show
End Sub

Sub DoCaseChange()
If frmCase.optLower = True Then
LowerCase
ElseIf frmCase.optUpper = True Then
UpperCase
Else
TitleCase
End If
End Sub



Sub LowerCase()
For Each objCell In Selection
objCell.Value = LCase(objCell.Formula)
Next objCell
End Sub

Sub UpperCase()
For Each objCell In Selection
objCell.Value = UCase(objCell.Formula)
Next objCell
End Sub Sub TitleCase()
For Each objCell In Selection
objCell.Value = Application.Proper(objCell.Formula)
Next objCell
End Sub

can anyone tell me how to run from a hidden, unshared, unprotected workbook