PC Review


Reply
Thread Tools Rate Thread

Choose box, put cell contents, update

 
 
deeds
Guest
Posts: n/a
 
      30th Oct 2009
I have a drop down box that user chooses from this in turn place a 1, 2, 3 in
L11. At this point I want the code below to run placing the result in G6.
However, I have to physically go to cell L11, F2, enter to make it update.
How do I get G6 to update automatically after selection of choose box.

Thanks

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$L$11" And Target.Count = 1 Then
If (Target.Value) = "1" Then
Range("G6") = "Cat"
End If
End If
If Target.Address = "$L$11" And Target.Count = 1 Then
If (Target.Value) = "2" Then
Range("G6") = "Dog"
End If
End If
If Target.Address = "$L$11" And Target.Count = 1 Then
If (Target.Value) = "3" Then
Range("G6") = "Fish"
End If
End If
End Sub
 
Reply With Quote
 
 
 
 
Mike H
Guest
Posts: n/a
 
      30th Oct 2009
Hi,

Don't use the worksheet change event use the dropdown change event instead.
Right click it and use this simplified code

Sub DropDown1_Change()
Select Case Sheets("Sheet1").Range("L11")
Case Is = 1
Range("G6") = "Cat"
Case Is = 2
Range("G6") = "Dog"
Case Is = 3
Range("G6") = "Fish"
End Select
End Sub

Mike

"deeds" wrote:

> I have a drop down box that user chooses from this in turn place a 1, 2, 3 in
> L11. At this point I want the code below to run placing the result in G6.
> However, I have to physically go to cell L11, F2, enter to make it update.
> How do I get G6 to update automatically after selection of choose box.
>
> Thanks
>
> Private Sub Worksheet_Change(ByVal Target As Range)
> If Target.Address = "$L$11" And Target.Count = 1 Then
> If (Target.Value) = "1" Then
> Range("G6") = "Cat"
> End If
> End If
> If Target.Address = "$L$11" And Target.Count = 1 Then
> If (Target.Value) = "2" Then
> Range("G6") = "Dog"
> End If
> End If
> If Target.Address = "$L$11" And Target.Count = 1 Then
> If (Target.Value) = "3" Then
> Range("G6") = "Fish"
> End If
> End If
> End Sub

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Update cell contents based on worksheet name =?Utf-8?B?UEo=?= Microsoft Excel Misc 1 8th Aug 2007 10:37 PM
Macro to update contents of cell =?Utf-8?B?TG91aXNl?= Microsoft Excel Programming 4 2nd Dec 2005 09:30 PM
Can I use cell contents to update footers in excel? =?Utf-8?B?R3JlZ1c=?= Microsoft Excel Misc 2 15th Aug 2005 06:49 PM
Re: Update the contents of a cell triggered by system clock Frank Kabel Microsoft Excel Misc 1 27th Jul 2004 11:53 PM
Update a cell contents otherwise show blank ndavies Microsoft Excel Discussion 4 12th Jul 2004 10:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:24 AM.