Solved

Tab Button on Excel

Posted on 2002-06-06
5
168 Views
Last Modified: 2011-04-14
Good Day, Have another knowledge question. I have an excel worksheet. What i am trying to figure out is when the user is on a certain cell say for example on my sheet cell ag26 and hits the tab button, it will automatically initiate a macro. How do i go about setting this up. These are the cells i need this to happen on. ag26,ag28,ag30,ag32,ag34. Any help would be greatly appreciated

0
Comment
Question by:sandramac
  • 4
5 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7060362
First, in your macro you have to check for activecell, it active cell is in range proceed, else exit the macro.
Second, Why to use Tab (key?)?
You can assign a Hotkey to a macro but it is a combination not only Tab.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7060382
Go to Tools, Macro, Macros.
select macro name and push in Options button
Type the hotkey
0
 

Author Comment

by:sandramac
ID: 7061522
You would not know how this code would be written would you. THe main thing is how do i have the active cell compare to the range i need.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 7063848
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Select Case Target.AddressLocal
Case "$AG$26", "$AG$28", "$AG$30", "$AG$32", "$AG$34"
    Call YourMacro
Case Else
    ' do nothing
End Select

End Sub
0
 
LVL 16

Accepted Solution

by:
Richie_Simonetti earned 75 total points
ID: 7063851
'or in YourMacro (activated by hotkey):
sub MyMacro()
Select Case activecell.AddressLocal
Case "$AG$26", "$AG$28", "$AG$30", "$AG$32", "$AG$34"
   'do your stuff here
Case Else
   ' do nothing
End Select


end sub
0

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question