LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 17
Default Worksheet_Change Event

Hell

I am trying to update a range that when a number is entered, a "#" is added to the beginning. I used the following code

Dim OSCksRange As Rang
Dim IntersectRange As Rang

Set OSCksRange = Range("OSCKs"
Set IntersectRange = Intersect(Target, OSCksRange

If Not IntersectRange Is Nothing The
Target.Value = "#" & Target.Valu
End I

If I enter anything into OSCKs range, the event keeps looping and appending '#' until the cell reaches its max number of characters. So I added the following code to the beginnin

If Left(Target, 1) = "#" The
Exit Su
End I

which solved that problem, but if I delete a character, it puts a "#" in the cell. So I tried addin

If Target.Value = Empty The
Exit Su
End I

which solved that problem, but if I delete more than one cell at a time I get a Type mismatch error

Is there a way to check and see what type of change has taken place, and if a number was entered run my original code

Any help would be appreciated

Thank
Sam
 
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
Disabling WORKSHEET_CHANGE event Jase Excel Discussion (Misc queries) 1 April 25th 08 04:32 PM
Controling the Worksheet_Change Event? DCSwearingen Excel Discussion (Misc queries) 3 May 25th 06 08:32 PM
Worksheet_Change event question marwan hefnawy Excel Programming 1 September 10th 03 08:53 PM
xl97 and Worksheet_Change event ? Greg Wilson[_3_] Excel Programming 1 September 10th 03 04:17 AM
Worksheet_Change Event Not Working Michael Beckinsale Excel Programming 0 August 1st 03 02:43 PM


All times are GMT +1. The time now is 06:02 PM.

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"