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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2003: VBA for cursor movement?

Status
Not open for further replies.

goopit

Technical User
May 9, 2003
43
US
G'day All,

I'm wondering if there is a way to write a VBA that will return the cursor to cell A1 after a date is entered and the Enter or Tab keys have been struck.

The sheet I'm working on is very simple. A date is returned in cell B1 after a date is entered in A1 based upon this little thing: =WORKDAY(A1,-8, HOLIDAYS).

Thanks, in advance, for any and all assistance.

goopit
 




Hi,

"...after a date is entered ..."

"=WORKDAY(A1,-8, HOLIDAYS)"

you ENTER the formula ONE TIME.

After that, nothing is ENTERED.

What else is happening in this workbook? Your question is rather cryptic.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I believe that the event you are searching for is the following:


BTW place this in the worksheet event.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Cells(1, 1).Activate
End Sub
For what you want to do with it, I wouldnt know.

Note that with this code, everytime a cell changes anywhere you will return to A1, and its far from being perfect or dynamic.

But with so little details, its all I can think of.

HTH,

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 
Skip,

Nothing else is happening in the workbook. I just thought it would be "cute" if there were a way to write something that will move the cursor from B1 back to A1 without me manually hitting the left arrow key.

It's just a purely lazy notion that occurred to me is all.

goopit
 
Sounds like a waste of time and bandwith to me,

NEXT iThread

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 




Sorry, ItIsHardToProgram, but when a cell calculates and returns a new value, NOTHING is changed. There IS NO CHANGE event triggered with a calculation.

Of course, you could do that for the Worksheet_Calculate event, but each time the sheet calculates, regardless of WHICH calculation, your activecell would become A1.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
after a date is entered and the Enter or Tab"

I understood it was after an input? not after the calculation, maybe im wrong?

Either as stated, this thread is a waste of bandwith since its serve no purpouse.

" I just thought it would be "cute" if there were a way to write something that will move the cursor "

Exit sub

"Knowing that you know is the greatest sign of stupidity, knowing that you are ignorant is the best proof of intelligence.
 



Check out the SelectionChange event.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top