Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 66
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to record keystrokes ? Steve[_9_] Excel Discussion (Misc queries) 4 December 5th 07 02:44 PM
Recording a Macro that follows Keystrokes freakyquo Excel Discussion (Misc queries) 3 September 6th 07 04:42 PM
Special keystrokes in a Macro Eric Excel Discussion (Misc queries) 4 May 18th 05 02:26 PM
How do I create a macro of editing keystrokes? scjanner Excel Discussion (Misc queries) 0 January 21st 05 11:07 PM
Relative Macro Help on Keystrokes Neal Zimm Excel Discussion (Misc queries) 9 December 15th 04 12:31 AM


All times are GMT +1. The time now is 11:53 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"