Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 358
Default Last Cell Accessed

Hi,

I want to capture the last cell data was entered so I can validate it and
return the cursor there if required. The user can 'Enter' or 'Arrow' away.

Any ideas?
--
Andrew
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Last Cell Accessed

use the CHANGE event for the sheet....right click the tab and select the code
page. This is the sheet's code page....then you can code the proc below,
where Target is the cell hat has changed. Caution....if the procedure changes
the value of any cell, then it will call itself...thats ok if the resultant
call doesn't make any more changes. If it does, then you'll set off a
recursive loop....so set Application.EnableEvents = False to turn off event
handling first!.
Example:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
' test for a given range, where the values must be 1< 10
If Not Intersect(Range("InputArea"), Target) Is Nothing Then
Application.EnableEvents = False
Select Case Target.Value

Case Is < 1
Target.Value = 1
Case Is 10
Target.Value = 10
End Select
Application.EnableEvents = True
End If
End Sub


"Andrew" wrote:

Hi,

I want to capture the last cell data was entered so I can validate it and
return the cursor there if required. The user can 'Enter' or 'Arrow' away.

Any ideas?
--
Andrew

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 358
Default Last Cell Accessed

Sorry but I don'tt think this is the answer I'm after.

The user enters directly into a spreadsheet (don't want to use a form) in
various locations. If the user keys in a particular range "K53:K58" I use
Worksheet_Change to do some some data validation. Thie validation works fine
but the cursor remains away from the cell in error.

I want to return to the cell in error.
--
Andrew


"Patrick Molloy" wrote:

use the CHANGE event for the sheet....right click the tab and select the code
page. This is the sheet's code page....then you can code the proc below,
where Target is the cell hat has changed. Caution....if the procedure changes
the value of any cell, then it will call itself...thats ok if the resultant
call doesn't make any more changes. If it does, then you'll set off a
recursive loop....so set Application.EnableEvents = False to turn off event
handling first!.
Example:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
' test for a given range, where the values must be 1< 10
If Not Intersect(Range("InputArea"), Target) Is Nothing Then
Application.EnableEvents = False
Select Case Target.Value

Case Is < 1
Target.Value = 1
Case Is 10
Target.Value = 10
End Select
Application.EnableEvents = True
End If
End Sub


"Andrew" wrote:

Hi,

I want to capture the last cell data was entered so I can validate it and
return the cursor there if required. The user can 'Enter' or 'Arrow' away.

Any ideas?
--
Andrew

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
Cannot be Accessed Vick Excel Discussion (Misc queries) 0 April 18th 08 08:49 PM
File cannot be accessed KMc Excel Discussion (Misc queries) 2 July 20th 06 03:56 PM
Spreadsheet accessed/used by anyone! debra Excel Discussion (Misc queries) 0 December 12th 05 12:27 AM
Return to the last accessed cell in a multiple paged file at reent Craftsman Excel Discussion (Misc queries) 0 November 15th 05 08:42 PM
"file" cannot be accessed FJB Excel Discussion (Misc queries) 4 May 18th 05 03:45 AM


All times are GMT +1. The time now is 10:54 AM.

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

About Us

"It's about Microsoft Excel"