LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 618
Default lookup value and change background colour

Hi Tom (Bob)

thanks for your responses - the bit i didn't do when i tried this was use
the "target" ... all makes sense now.

thanks for your time & asssistance.
Regards

"Tom Ogilvy" wrote in message
...
Some corrections (inattention to detail).

ActiveCell should be Target and since we already had assumed B18 for
category and C18 for Month

Private Sub Worksheet_Change(ByVal Target As Range)

Dim res as Variant, res1 as Variant
Dim rng as Range
if Target.count 1 then exit sub
if Target.Address = "$C$18" and not isempty(Range("B18")) then
res = Application.Match(Range("B18"),Range("Categories") ,0)
res1 = Application.Match(Range("C18"),Range("Months"),0)
if not iserror(res) and not iserror(res1) then
set rng =Range("Product!A7").offset(res,res1)
if rng.Interior.ColorIndex = 6 then
msgbox "not available"
else
Application.EnableEvents = False
Target.Value = rng.Value
Application.EnableEvents = True
rng.Interior.ColorIndex = 6
end if
Else
Msgbox "location not found"

End if
End if

End Sub

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
Category Month Num Items
d/d list d/d list offset & match

If using Excel 2000 or later, you would use the Change Event


assume the month dropdown is in cell f5 and the category dropdown in E5
Private Sub Worksheet_Change(ByVal Target As Range)

Dim res as Variant, res1 as Variant
Dim rng as Range
if Target.count 1 then exit sub
if Target.Address = "$F$5" and not isempty(Range("E5")) then
res = Application.Match(Range("B18"),Range("Categories") ,0)
res1 = Application.Match(Range("C18"),Range("Months"),0)
if not iserror(res) and not iserror(res1) then
set rng =Range("Product!A7").offset(res,res1)
if rng.Interior.ColorIndex = 6 then
msgbox "not available"
else
Application.EnableEvents = False
activecell.Value = rng.Value
Application.EnableEvents = True
rng.Interior.ColorIndex = 6
end if
Else
Msgbox "location not found"

End if
End if

End Sub

--
Regards,
Tom Oiglvy

"JulieD" wrote in message
...
Hi Tom

this is my problem, i would like it to execute when the the user has
selected the month (after selecting the category) so i'm guessing i

need
to
use the worksheet_selectionchange event but i don't know how to get it

to
work.

Cheers
JulieD

--snip--










 
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
How can I change worksheet background colour Mark Setting up and Configuration of Excel 2 January 5th 21 07:17 AM
Change background colour hollies Excel Worksheet Functions 3 October 8th 09 11:54 PM
Change Font Colour and Background If Q [email protected] Excel Worksheet Functions 11 September 27th 06 05:59 PM
change a cell background colour to my own RGB colour requirements Stephen Doughty Excel Discussion (Misc queries) 4 June 16th 06 01:08 PM
change background colour cityfc Excel Discussion (Misc queries) 1 November 11th 05 01:03 PM


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