Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 84
Default Change by value



I have a this code.
the problem is when the "Card Entered" part is also a value change...so it
just keeps repeating. is there a way to make it so if value = "Card Entered"
the code does not run

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("fa7").Address Then
Range("fc7").Value = Range("fa7").Value
Range("fa7") = "Card Entered"
End If
End Sub

ThaNKS in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,120
Default Change by value

Private Sub Worksheet_Change(ByVal Target As Range)

Application.EnableEvents = False
On Error Goot ws_exit:
If Target.Address = Range("fa7").Address Then
Range("fc7").Value = Range("fa7").Value
Range("fa7") = "Card Entered"
End If

ws_exit:
Application.EnableEvents = True
End Sub


--
HTH

Bob Phillips

"choice" wrote in message
...


I have a this code.
the problem is when the "Card Entered" part is also a value change...so it
just keeps repeating. is there a way to make it so if value = "Card

Entered"
the code does not run

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("fa7").Address Then
Range("fc7").Value = Range("fa7").Value
Range("fa7") = "Card Entered"
End If
End Sub

ThaNKS in advance



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Change by value

Any thime you are using the on change event you have to be careful about
having the procedure call itself recursivly. This occures if you change a
value within the procedure which causes the procedure to fire again. To avoid
this you need to add

application.enableevents = false

at the beginning of the code and

application.enableevents = true

at the end of the code... Be careful to always turn the events back on
again...

HTH

"choice" wrote:



I have a this code.
the problem is when the "Card Entered" part is also a value change...so it
just keeps repeating. is there a way to make it so if value = "Card Entered"
the code does not run

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("fa7").Address Then
Range("fc7").Value = Range("fa7").Value
Range("fa7") = "Card Entered"
End If
End Sub

ThaNKS in advance

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
change scaling % but font size didnt change porportionally, pls he Scaling question Excel Discussion (Misc queries) 0 March 12th 07 03:16 AM
Excel bar chart formatting of bars to change colors as data change JudyT Excel Discussion (Misc queries) 1 January 24th 07 06:07 PM
Use date modified to change format & create filter to track change PAR Excel Worksheet Functions 0 November 15th 06 09:17 PM
Change workbook sheet reference using cell A1 to change a vairable Reed Excel Worksheet Functions 4 January 20th 05 07:15 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM


All times are GMT +1. The time now is 02:03 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"