Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Make next select cell go vertical instead or horizontal

Status
Not open for further replies.

chrisdq

Programmer
Nov 6, 2002
77
US
Hi,

I have 2 addresses on the same line such as

ADDRESS_1 ADDRESS_2
------------ ------------------
Street_1 Street_2
City_1, State_1 City_2, State_2


When I press the tab key from street_1 I want it to go to city_1, state_1 then street_2, city_2, state_2. Is there a way to control it using either vba or excel functions???

Thank you very much in advance
 
Bluehorizon,

Thanks for your reply.

I've tried it and it does not work, it still goes to the horizontal cell when I press the tab key eventhough the vertical cells are highlighted.

I'm looking for a function or vba code to do it automatically though.

Is there a way to get the current cell position in code??

Thanks
 
Would Tools,Options, Edit "Move Selection after Enter" solve your issue? (you can select the direction to move).

Or you could simply press the down arrow instead of enter or tab.

Thanks,

Gavin
 
Hi,

Thank you for all of your reply.

Actually I have other data besides the 2 addresses and I just want the cell to move down vertical instead of horizonal only for the addresses, other than that I want it to go the normal way which is horizontal direction when pressing the tab key.

Is there a way to detect a tab key from vba????
I'm using ActiveCell.Column & ActiveCell.Row to get the current Col and Cell values so I need to detect when there is a tab key at these cells I just move the focus to the next vertical cell.

Can someone tell me the code/function to use to detect the tab key???

Thanks a lot
 
You can detect a TAB with the Application.OnKey command.
Code:
Application.OnKey "{TAB}","myMacro"    'Run sub myMacro when TAB key hit
Application.OnKey "TAB"    'Restore normal operation of TAB key
You will probably want to create two macros--one to associate your macro sub to the TAB key, and the other to unassociate it. One good approach is to put the former in a Workbook_Open and the latter in a Workbook_Close sub.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top