Solved

Tab Button on Excel

Posted on 2002-06-06
5
167 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now