Jumat, 17 Oktober 2014

Re: [ExcelVBA] Validation list change events

 

Glad to help.
------
 
The problem is with how we interpret the terms.
 
It is easy to see how you could expect to use the SelectionChange event
when you want to run a macro when you change a selected cell.
after all, both terms seem to apply.
 
The problem is that Microsoft needed to differentiate between SELECTING cells, and CHANGING cells.
 
or you could say it's the difference between changing the cells SELECTED and changing the CONTENT of the cells selected.
 
I wouldn't expect that there are very many ways to come up with an event name that would easily differentiate between the two.
 
So they have Worksheet_Change()
and Worksheet_SelectionChange()
 
Even then, it's easy to expect that Worksheet_Change is for changing the worksheet, not changing the CONTENT of the worksheet, but of course that is not the case.
 
As you said, you do not do this enough.
once you've done a couple dozen (or a couple dozen dozen) than you can spot it right away!
 
let me know if you come across any other challenges!
 
Paul
-----------------------------------------
"Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can." - John Wesley
-----------------------------------------

From: "Mark Bacheldor m_bacheldor@yahoo.com [ExcelVBA]" <ExcelVBA@yahoogroups.com>
To: ExcelVBA@yahoogroups.com
Sent: Thursday, October 16, 2014 3:02 PM
Subject: Re: [ExcelVBA] Validation list change events

 
Paul,

Once again you have helped me. I do not do this enough. I got it stuck in my head that I need a selection change event and went down the wrong path.

Thank you

Mark
--------------------------------------------
On Thu, 10/16/14, Paul Schreiner schreiner_paul@att.net [ExcelVBA] <ExcelVBA@yahoogroups.com> wrote:

Subject: Re: [ExcelVBA] Validation list change events

To: "ExcelVBA@yahoogroups.com" <ExcelVBA@yahoogroups.com>
Date: Thursday, October 16, 2014, 2:50 PM


 










How do you WANT it to
work? You wrote this as the
SelectionChange event.that means that it only
runs when you select a cell.and the target is
the cell you've SELECTED. If you
make it a Change event,then it will operate on
the cell that's been
Changed.  Paul-----------------------------------------
"Do all the good
you can,
By all the means you can,
In all the ways you can,
In all
the places you can,
At all the times you
can,
To all the people you can,
As long as ever you can." - John
Wesley
-----------------------------------------

From:
"m_bacheldor@yahoo.com [ExcelVBA]"
<ExcelVBA@yahoogroups.com>
To:
ExcelVBA@yahoogroups.com
Sent: Thursday,
October 16, 2014 1:12 PM
Subject: [ExcelVBA]
Validation list change events




 










Good afternoon
all,
I have created a valiation list and added the following
code to it but I can't get it to fire/update until I
manually move off of the list/cell then back on to it.
Option Explicit
Private Sub
Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address =
Me.Range("FormSel").Address Then
    If Target.Value = "Blended"
Then
       
Sheets("Blended").Visible = True
        Else
       
Sheets("Blended").Visible = False
    End If
    If
Target.Value = "Flat Rate" Then
        Sheets("Flat
Rate").Visible = True
       
Else
        Sheets("Flat
Rate").Visible = False
    End If
    If Target.Value = "Preferred"
Then
       
Sheets("Preferred").Visible = True
        Else
       
Sheets("Preferred").Visible = False
    End If
    If
Target.Value = "Standard" Then
       
Sheets("Standard").Visible = True
        Else
       
Sheets("Standard").Visible = False
    End If
End If
   
End
Sub
What am I missing?
 
Thank you,
 
Mark  





















#yiv7719197668 #yiv7719197668 --
#yiv7719197668ygrp-mkp {
border:1px solid #d8d8d8;font-family:Arial;margin:10px
0;padding:0 10px;}

#yiv7719197668 #yiv7719197668ygrp-mkp hr {
border:1px solid #d8d8d8;}

#yiv7719197668 #yiv7719197668ygrp-mkp #yiv7719197668hd {
color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px
0;}

#yiv7719197668 #yiv7719197668ygrp-mkp #yiv7719197668ads {
margin-bottom:10px;}

#yiv7719197668 #yiv7719197668ygrp-mkp .yiv7719197668ad {
padding:0 0;}

#yiv7719197668 #yiv7719197668ygrp-mkp .yiv7719197668ad p {
margin:0;}

#yiv7719197668 #yiv7719197668ygrp-mkp .yiv7719197668ad a {
color:#0000ff;text-decoration:none;}
#yiv7719197668 #yiv7719197668ygrp-sponsor
#yiv7719197668ygrp-lc {
font-family:Arial;}


#yiv7719197668 #yiv7719197668ygrp-sponsor
#yiv7719197668ygrp-lc #yiv7719197668hd {
margin:10px
0px;font-weight:700;font-size:78%;line-height:122%;}

#yiv7719197668 #yiv7719197668ygrp-sponsor
#yiv7719197668ygrp-lc .yiv7719197668ad {
margin-bottom:10px;padding:0 0;}

#yiv7719197668 #yiv7719197668actions {
font-family:Verdana;font-size:11px;padding:10px 0;}

#yiv7719197668 #yiv7719197668activity {
background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}

#yiv7719197668 #yiv7719197668activity span {
font-weight:700;}

#yiv7719197668 #yiv7719197668activity span:first-child {
text-transform:uppercase;}

#yiv7719197668 #yiv7719197668activity span a {
color:#5085b6;text-decoration:none;}

#yiv7719197668 #yiv7719197668activity span span {
color:#ff7900;}

#yiv7719197668 #yiv7719197668activity span
.yiv7719197668underline {
text-decoration:underline;}

#yiv7719197668 .yiv7719197668attach {
clear:both;display:table;font-family:Arial;font-size:12px;padding:10px
0;width:400px;}

#yiv7719197668 .yiv7719197668attach div a {
text-decoration:none;}

#yiv7719197668 .yiv7719197668attach img {
border:none;padding-right:5px;}

#yiv7719197668 .yiv7719197668attach label {
display:block;margin-bottom:5px;}

#yiv7719197668 .yiv7719197668attach label a {
text-decoration:none;}

#yiv7719197668 blockquote {
margin:0 0 0 4px;}

#yiv7719197668 .yiv7719197668bold {
font-family:Arial;font-size:13px;font-weight:700;}

#yiv7719197668 .yiv7719197668bold a {
text-decoration:none;}

#yiv7719197668 dd.yiv7719197668last p a {
font-family:Verdana;font-weight:700;}

#yiv7719197668 dd.yiv7719197668last p span {
margin-right:10px;font-family:Verdana;font-weight:700;}

#yiv7719197668 dd.yiv7719197668last p
span.yiv7719197668yshortcuts {
margin-right:0;}

#yiv7719197668 div.yiv7719197668attach-table div div a {
text-decoration:none;}

#yiv7719197668 div.yiv7719197668attach-table {
width:400px;}

#yiv7719197668 div.yiv7719197668file-title a, #yiv7719197668
div.yiv7719197668file-title a:active, #yiv7719197668
div.yiv7719197668file-title a:hover, #yiv7719197668
div.yiv7719197668file-title a:visited {
text-decoration:none;}

#yiv7719197668 div.yiv7719197668photo-title a,
#yiv7719197668 div.yiv7719197668photo-title a:active,
#yiv7719197668 div.yiv7719197668photo-title a:hover,
#yiv7719197668 div.yiv7719197668photo-title a:visited {
text-decoration:none;}

#yiv7719197668 div#yiv7719197668ygrp-mlmsg
#yiv7719197668ygrp-msg p a span.yiv7719197668yshortcuts {
font-family:Verdana;font-size:10px;font-weight:normal;}

#yiv7719197668 .yiv7719197668green {
color:#628c2a;}

#yiv7719197668 .yiv7719197668MsoNormal {
margin:0 0 0 0;}

#yiv7719197668 o {
font-size:0;}

#yiv7719197668 #yiv7719197668photos div {
float:left;width:72px;}

#yiv7719197668 #yiv7719197668photos div div {
border:1px solid
#666666;height:62px;overflow:hidden;width:62px;}

#yiv7719197668 #yiv7719197668photos div label {
color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}

#yiv7719197668 #yiv7719197668reco-category {
font-size:77%;}

#yiv7719197668 #yiv7719197668reco-desc {
font-size:77%;}

#yiv7719197668 .yiv7719197668replbq {
margin:4px;}

#yiv7719197668 #yiv7719197668ygrp-actbar div a:first-child {
margin-right:2px;padding-right:5px;}

#yiv7719197668 #yiv7719197668ygrp-mlmsg {
font-size:13px;font-family:Arial, helvetica, clean,
sans-serif;}

#yiv7719197668 #yiv7719197668ygrp-mlmsg table {
font-size:inherit;font:100%;}

#yiv7719197668 #yiv7719197668ygrp-mlmsg select,
#yiv7719197668 input, #yiv7719197668 textarea {
font:99% Arial, Helvetica, clean, sans-serif;}

#yiv7719197668 #yiv7719197668ygrp-mlmsg pre, #yiv7719197668
code {
font:115% monospace;}

#yiv7719197668 #yiv7719197668ygrp-mlmsg * {
line-height:1.22em;}

#yiv7719197668 #yiv7719197668ygrp-mlmsg #yiv7719197668logo {
padding-bottom:10px;}


#yiv7719197668 #yiv7719197668ygrp-msg p a {
font-family:Verdana;}

#yiv7719197668 #yiv7719197668ygrp-msg
p#yiv7719197668attach-count span {
color:#1E66AE;font-weight:700;}

#yiv7719197668 #yiv7719197668ygrp-reco
#yiv7719197668reco-head {
color:#ff7900;font-weight:700;}

#yiv7719197668 #yiv7719197668ygrp-reco {
margin-bottom:20px;padding:0px;}


#yiv7719197668 #yiv7719197668ygrp-sponsor #yiv7719197668ov
li a {
font-size:130%;text-decoration:none;}

#yiv7719197668 #yiv7719197668ygrp-sponsor #yiv7719197668ov
li {
font-size:77%;list-style-type:square;padding:6px 0;}

#yiv7719197668 #yiv7719197668ygrp-sponsor #yiv7719197668ov
ul {
margin:0;padding:0 0 0 8px;}

#yiv7719197668 #yiv7719197668ygrp-text {
font-family:Georgia;}

#yiv7719197668 #yiv7719197668ygrp-text p {
margin:0 0 1em 0;}

#yiv7719197668 #yiv7719197668ygrp-text tt {
font-size:120%;}

#yiv7719197668 #yiv7719197668ygrp-vital ul li:last-child {
border-right:none !important;
}
#yiv7719197668



__._,_.___

Posted by: Paul Schreiner <schreiner_paul@att.net>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------

.

__,_._,___

Tidak ada komentar:

Poskan Komentar