Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Worksheet_Change not updating with vlookup change

Hi -

I use the following to change the background color of a cell. Is worksheet_change triggered with changes in a value returned by a vlookup? My worksheet does not update until I go into the individual cell and update the forumla, then the color changes. How would I use this function? Please help

Thanks, Ada

Private Sub Worksheet_Change(ByVal Target As Range
Dim Num As Lon
Dim rng As Rang
Dim vRngInput As Varian
Set vRngInput = Intersect(Target, Range("C:C,I:I,O:O,U:U,AA:AA,AG:AG")
If vRngInput Is Nothing Then Exit Su
For Each rng In vRngInpu
'Determine the colo
Select Case rng.Valu
Case Is = "T-1": Num = 6 'yello
Case Is = "T-2": Num = 10 'gree
Case Is = "T-3": Num = 5 'blu
Case Is = "SALE": Num = 3 're
Case Is = 5: Num = 46 'orang
End Selec
'Apply the colo
rng.Interior.ColorIndex = Nu
Next rn
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Worksheet_Change not updating with vlookup change

Hi
worksheet_change is NOT triggered by a formula change. You may use the
worksheet_calculate event for this

--
Regards
Frank Kabel
Frankfurt, Germany

"Adam" schrieb im Newsbeitrag
...
Hi -

I use the following to change the background color of a cell. Is

worksheet_change triggered with changes in a value returned by a
vlookup? My worksheet does not update until I go into the individual
cell and update the forumla, then the color changes. How would I use
this function? Please help.

Thanks, Adam

Private Sub Worksheet_Change(ByVal Target As Range)
Dim Num As Long
Dim rng As Range
Dim vRngInput As Variant
Set vRngInput = Intersect(Target,

Range("C:C,I:I,O:O,U:U,AA:AA,AG:AG"))
If vRngInput Is Nothing Then Exit Sub
For Each rng In vRngInput
'Determine the color
Select Case rng.Value
Case Is = "T-1": Num = 6 'yellow
Case Is = "T-2": Num = 10 'green
Case Is = "T-3": Num = 5 'blue
Case Is = "SALE": Num = 3 'red
Case Is = 5: Num = 46 'orange
End Select
'Apply the color
rng.Interior.ColorIndex = Num
Next rng
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Worksheet_Change not updating with vlookup change

OK, I see.

When I move this to worksheet_calculate event, I receive a compile error about a procedure declaration. Do you have any insight

Thanks

Ada

----- Frank Kabel wrote: ----

H
worksheet_change is NOT triggered by a formula change. You may use th
worksheet_calculate event for thi

-
Regard
Frank Kabe
Frankfurt, German

"Adam" schrieb im Newsbeitra
..
Hi
I use the following to change the background color of a cell. I

worksheet_change triggered with changes in a value returned by
vlookup? My worksheet does not update until I go into the individua
cell and update the forumla, then the color changes. How would I us
this function? Please help
Thanks, Ada
Private Sub Worksheet_Change(ByVal Target As Range

Dim Num As Lon
Dim rng As Rang
Dim vRngInput As Varian
Set vRngInput = Intersect(Target

Range("C:C,I:I,O:O,U:U,AA:AA,AG:AG")
If vRngInput Is Nothing Then Exit Su
For Each rng In vRngInpu
'Determine the colo
Select Case rng.Valu
Case Is = "T-1": Num = 6 'yello
Case Is = "T-2": Num = 10 'gree
Case Is = "T-3": Num = 5 'blu
Case Is = "SALE": Num = 3 're
Case Is = 5: Num = 46 'orang
End Selec
'Apply the colo
rng.Interior.ColorIndex = Nu
Next rn
End Su



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Worksheet_Change not updating with vlookup change

Hi
the worksheet_claculate event has a different procedure stub:
Private Sub Worksheet_Calculate()
'your code
End Sub

--
Regards
Frank Kabel
Frankfurt, Germany

"Adam" schrieb im Newsbeitrag
...
OK, I see.

When I move this to worksheet_calculate event, I receive a compile

error about a procedure declaration. Do you have any insight.

Thanks,

Adam

----- Frank Kabel wrote: -----

Hi
worksheet_change is NOT triggered by a formula change. You may

use the
worksheet_calculate event for this

--
Regards
Frank Kabel
Frankfurt, Germany

"Adam" schrieb im

Newsbeitrag
...
Hi -
I use the following to change the background color of a cell.

Is
worksheet_change triggered with changes in a value returned by a
vlookup? My worksheet does not update until I go into the

individual
cell and update the forumla, then the color changes. How would

I use
this function? Please help.
Thanks, Adam
Private Sub Worksheet_Change(ByVal Target As Range)

Dim Num As Long
Dim rng As Range
Dim vRngInput As Variant
Set vRngInput = Intersect(Target,

Range("C:C,I:I,O:O,U:U,AA:AA,AG:AG"))
If vRngInput Is Nothing Then Exit Sub
For Each rng In vRngInput
'Determine the color
Select Case rng.Value
Case Is = "T-1": Num = 6 'yellow
Case Is = "T-2": Num = 10 'green
Case Is = "T-3": Num = 5 'blue
Case Is = "SALE": Num = 3 'red
Case Is = 5: Num = 46 'orange
End Select
'Apply the color
rng.Interior.ColorIndex = Num
Next rng
End Sub




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Worksheet_Change not updating with vlookup change

The calculate event does not have an argument, so if you left the ByRef
Target bit in, that is your error.

You should also realise that this event gets triggered by any
re-calculation, you cannot monitor it to one particular cell, so the code
has to change as well.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Adam" wrote in message
...
OK, I see.

When I move this to worksheet_calculate event, I receive a compile error

about a procedure declaration. Do you have any insight.

Thanks,

Adam

----- Frank Kabel wrote: -----

Hi
worksheet_change is NOT triggered by a formula change. You may use

the
worksheet_calculate event for this

--
Regards
Frank Kabel
Frankfurt, Germany

"Adam" schrieb im Newsbeitrag
...
Hi -
I use the following to change the background color of a cell. Is

worksheet_change triggered with changes in a value returned by a
vlookup? My worksheet does not update until I go into the individual
cell and update the forumla, then the color changes. How would I use
this function? Please help.
Thanks, Adam
Private Sub Worksheet_Change(ByVal Target As Range)

Dim Num As Long
Dim rng As Range
Dim vRngInput As Variant
Set vRngInput = Intersect(Target,

Range("C:C,I:I,O:O,U:U,AA:AA,AG:AG"))
If vRngInput Is Nothing Then Exit Sub
For Each rng In vRngInput
'Determine the color
Select Case rng.Value
Case Is = "T-1": Num = 6 'yellow
Case Is = "T-2": Num = 10 'green
Case Is = "T-3": Num = 5 'blue
Case Is = "SALE": Num = 3 'red
Case Is = 5: Num = 46 'orange
End Select
'Apply the color
rng.Interior.ColorIndex = Num
Next rng
End Sub







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
updating from vlookup Sandy P Excel Discussion (Misc queries) 8 October 4th 06 07:32 PM
Updating Functions (Vlookup) scoutfinch22 Excel Worksheet Functions 1 December 27th 05 11:25 PM
auto-filter change not triggering worksheet_change event mark Excel Programming 1 September 19th 03 03:01 PM
worksheet_change vs. calculate, and worksheet_change not running Tom Ogilvy Excel Programming 1 July 14th 03 02:51 AM
worksheet_change vs. calculate, and worksheet_change not running Ross[_5_] Excel Programming 0 July 13th 03 04:27 PM


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