Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Toggle Macro with KeyStrokes
Hi guys,
I have a macro that unhides and hides some columns. I have a button that toggles the macro depending on the label of the button. But cause a button takes too much space,( I have other buttons there too) I would like to know if there is a way to program a combination of keystrokes to handle my macro. for example CTRL + "-" will hide columns and CTRL + "+" will unhide them. the simple current macro look like this. Sub hide() Dim x As String Dim cell As Range If ActiveSheet.Buttons(Application.Caller).Caption = "Select Store" Then x = InputBox("Please insert the store 3 letters initials. ie. GRW or FRA", "This a test only") x = UCase(x) If x = "" Then Exit Sub Else If Len(x) 3 Then MsgBox "Please only 3 letters" Else Range("v1").Select For Each cell In Range("v1:CL1") If Left(cell.Value, 3) < x Then cell.EntireColumn.Hidden = True End If Next cell ActiveSheet.Buttons(1).Caption = "Show All" End If End If Else If ActiveSheet.Buttons(Application.Caller).Caption = "Show All" Then Range("v1:CL1").EntireColumn.Hidden = False ActiveSheet.Buttons(Application.Caller).Caption = "Select Store" End If End If end sub Gracias for you help. Cesar........ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro to record keystrokes ? | Excel Discussion (Misc queries) | |||
Recording a Macro that follows Keystrokes | Excel Discussion (Misc queries) | |||
Special keystrokes in a Macro | Excel Discussion (Misc queries) | |||
How do I create a macro of editing keystrokes? | Excel Discussion (Misc queries) | |||
Relative Macro Help on Keystrokes | Excel Discussion (Misc queries) |