Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
RAP RAP is offline
external usenet poster
 
Posts: 49
Default Workbook_SheetChange not working

It was working, but I changed a cell entry to a formula and now it won't run.
The two macros I call in the Sheetchange macro run fine when run manually.
Here's the code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
VRange = Range("B3:B7")
Call CheckCellColor
Call RoundOff
End Sub

What am I overlooking? Thanks for any help. - Randy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Workbook_SheetChange not working

Randy,

My event code is located in the "ThisWorkbook" module and looks like this....

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
End Sub

Also, does this serve any purpose? ..."VRange = Range("B3:B7")"

Jim Cone
San Francisco, USA


"RAP"

wrote in message

It was working, but I changed a cell entry to a formula and now it won't run.
The two macros I call in the Sheetchange macro run fine when run manually.
Here's the code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
VRange = Range("B3:B7")
Call CheckCellColor
Call RoundOff
End Sub
What am I overlooking? Thanks for any help. - Randy
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Workbook_SheetChange not working

Using Source instead of Target is of no relevance, but I would also be
interested to know how the called procedures know which cells are being
changed.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jim Cone" wrote in message
...
Randy,

My event code is located in the "ThisWorkbook" module and looks like

this....

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As

Range)
End Sub

Also, does this serve any purpose? ..."VRange = Range("B3:B7")"

Jim Cone
San Francisco, USA


"RAP"

wrote in message

It was working, but I changed a cell entry to a formula and now it won't

run.
The two macros I call in the Sheetchange macro run fine when run manually.
Here's the code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Source As

Range)
VRange = Range("B3:B7")
Call CheckCellColor
Call RoundOff
End Sub
What am I overlooking? Thanks for any help. - Randy



  #4   Report Post  
Posted to microsoft.public.excel.programming
RAP RAP is offline
external usenet poster
 
Posts: 49
Default Workbook_SheetChange not working

My bad. Here's the code now. It still is not running when a change is made
on the sheet. The code is located in Excel Objects, Sheet 2.

Private Sub WorkSheet_Change(ByVal Source As Range)
Source = Range("B3:B56")
Call CheckCellColor
End Sub
  #5   Report Post  
Posted to microsoft.public.excel.programming
RAP RAP is offline
external usenet poster
 
Posts: 49
Default Workbook_SheetChange not working

Something else is going on. I opened another functioning program that uses a
worksheet change event and it doesn't work either. Is there some way this
function was "turned off"?


"RAP" wrote:

My bad. Here's the code now. It still is not running when a change is made
on the sheet. The code is located in Excel Objects, Sheet 2.

Private Sub WorkSheet_Change(ByVal Source As Range)
Source = Range("B3:B56")
Call CheckCellColor
End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Workbook_SheetChange not working

Since you're using worksheet_change, your code has to be in the module for that
sheet. (Did you move it from the ThisWorkbook module?)

Also, if events are turned off:
application.enableevents = false

They'll have to be turned back on for your code to automatically run with the
next change.

But I wouldn't change the declaration of that procedure.

Private Sub Worksheet_Change(ByVal Target As Range)

And if you want to only look at cells within a certain range, you can use:

Private Sub Worksheet_Change(ByVal Target As Range)
if target.cells.count 1 then exit sub 'one cell at a time
if intersect(me.range("b3:b56"),target) is nothing then exit sub
'...

But who knows what's in that other subroutine???

RAP wrote:

Something else is going on. I opened another functioning program that uses a
worksheet change event and it doesn't work either. Is there some way this
function was "turned off"?

"RAP" wrote:

My bad. Here's the code now. It still is not running when a change is made
on the sheet. The code is located in Excel Objects, Sheet 2.

Private Sub WorkSheet_Change(ByVal Source As Range)
Source = Range("B3:B56")
Call CheckCellColor
End Sub


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Workbook_SheetChange not working

It seems to me that you have a mis-understanding of event, how they work
etc.

Source (or Target or whatever it is called) is a range, and so it needs to
be Set, not just assigned. Also, that range is passed to the procedure, so
why would you want to over-write it?

I suggest that you read up on it at http://www.cpearson.com/excel/events.htm

--

HTH

RP
(remove nothere from the email address if mailing direct)


"RAP" wrote in message
...
Something else is going on. I opened another functioning program that

uses a
worksheet change event and it doesn't work either. Is there some way this
function was "turned off"?


"RAP" wrote:

My bad. Here's the code now. It still is not running when a change is

made
on the sheet. The code is located in Excel Objects, Sheet 2.

Private Sub WorkSheet_Change(ByVal Source As Range)
Source = Range("B3:B56")
Call CheckCellColor
End Sub



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 86
Default Workbook_SheetChange not working

Try worksheet_calculate instead of worksheet_change
--
Gary's Student


"RAP" wrote:

It was working, but I changed a cell entry to a formula and now it won't run.
The two macros I call in the Sheetchange macro run fine when run manually.
Here's the code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Source As Range)
VRange = Range("B3:B7")
Call CheckCellColor
Call RoundOff
End Sub

What am I overlooking? Thanks for any help. - Randy

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
Workbook_SheetChange Matt B[_3_] Excel Programming 3 April 25th 05 01:40 PM
Worksheet_Change and Workbook_SheetChange not firing David Jenkins[_2_] Excel Programming 4 September 2nd 04 08:02 PM
Workbook_sheetChange event J S Excel Programming 0 August 9th 04 07:16 PM
workbook_sheetchange JulieD Excel Programming 1 June 14th 04 04:32 AM
Workbook_SheetChange will not fire Robert Willard Excel Programming 1 September 10th 03 07:52 PM


All times are GMT +1. The time now is 12:20 AM.

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

About Us

"It's about Microsoft Excel"