Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Validation List Question

I have a data validation list with a number of states in it. Each time I
select a new state I want 2 macros to run. The list is in cell A4 of Sheet
1. Here is the code I am using at the worksheet level, can someone tell me
what I'm doing wrong?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "A4" Then
pp_maj_macro
pp_minor_macro
End If
End Sub

Thanks so much,
Dave


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Validation List Question

Target.Address will return $A$4.

You could use:

If Target.Address = "$A$4" Then
or
If Target.Address(0,0) = "A4" Then
or (what I like)
if intersect(target,me.range("a4")) is nothing then exit sub

I find the last one easiest to modify (for multiple cells/ranges).


"dave!!" wrote:

I have a data validation list with a number of states in it. Each time I
select a new state I want 2 macros to run. The list is in cell A4 of Sheet
1. Here is the code I am using at the worksheet level, can someone tell me
what I'm doing wrong?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "A4" Then
pp_maj_macro
pp_minor_macro
End If
End Sub

Thanks so much,
Dave


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Validation List Question

If Target.Address = "$A$4" Then

or
If Target.Address(0,0) = "A4" Then

--
Regards,
Tom Ogilvy


"dave!!" wrote in message
...
I have a data validation list with a number of states in it. Each time I
select a new state I want 2 macros to run. The list is in cell A4 of

Sheet
1. Here is the code I am using at the worksheet level, can someone tell

me
what I'm doing wrong?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "A4" Then
pp_maj_macro
pp_minor_macro
End If
End Sub

Thanks so much,
Dave




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Validation List Question

I tried the first 2...but they're not working.


"Dave Peterson" wrote in message
...
Target.Address will return $A$4.

You could use:

If Target.Address = "$A$4" Then
or
If Target.Address(0,0) = "A4" Then
or (what I like)
if intersect(target,me.range("a4")) is nothing then exit sub

I find the last one easiest to modify (for multiple cells/ranges).


"dave!!" wrote:

I have a data validation list with a number of states in it. Each time

I
select a new state I want 2 macros to run. The list is in cell A4 of

Sheet
1. Here is the code I am using at the worksheet level, can someone tell

me
what I'm doing wrong?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "A4" Then
pp_maj_macro
pp_minor_macro
End If
End Sub

Thanks so much,
Dave


--

Dave Peterson



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Validation List Question

I put a message box in to verify that it's getting past the if statement,
and that's working fine, but the macros aren't running. Any thoughts?

Thanks,
Dave


"Tom Ogilvy" wrote in message
...
If Target.Address = "$A$4" Then

or
If Target.Address(0,0) = "A4" Then

--
Regards,
Tom Ogilvy


"dave!!" wrote in message
...
I have a data validation list with a number of states in it. Each time

I
select a new state I want 2 macros to run. The list is in cell A4 of

Sheet
1. Here is the code I am using at the worksheet level, can someone tell

me
what I'm doing wrong?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "A4" Then
pp_maj_macro
pp_minor_macro
End If
End Sub

Thanks so much,
Dave








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Validation List Question

I put a data validation dropdown in cell A4 and filled it from a list of
states in another column

then right clicked on the sheet tab and selected view code. I pasted in
this:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$4" Then
'pp_maj_macro
'pp_minor_macro
MsgBox Target.Address
End If
End Sub


then went back to excel and selected a state. Worked fine for me xl2003.
If you are using xl97, this situation does not trigger the change event.
Another possibility is that you have code that disables events.

sub ReEnableEvents()
Application.EnableEvents = True
End sub

Put in a general module and run it.

--
Regards,
Tom Ogilvy

"dave!!" wrote in message
...
I tried the first 2...but they're not working.


"Dave Peterson" wrote in message
...
Target.Address will return $A$4.

You could use:

If Target.Address = "$A$4" Then
or
If Target.Address(0,0) = "A4" Then
or (what I like)
if intersect(target,me.range("a4")) is nothing then exit sub

I find the last one easiest to modify (for multiple cells/ranges).


"dave!!" wrote:

I have a data validation list with a number of states in it. Each

time
I
select a new state I want 2 macros to run. The list is in cell A4 of

Sheet
1. Here is the code I am using at the worksheet level, can someone

tell
me
what I'm doing wrong?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "A4" Then
pp_maj_macro
pp_minor_macro
End If
End Sub

Thanks so much,
Dave


--

Dave Peterson





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Validation List Question

If the macros are in a general module in the same workbook, they should run.

If they are not defined, you should get an error. Otherwise they should
run. It is possible you have error handling in the subs and that causes
them to appear not to run. Possibly Put message boxes at the top of each
sub.

--
Regards,
Tom Ogilvy


"dave!!" wrote in message
...
I put a message box in to verify that it's getting past the if statement,
and that's working fine, but the macros aren't running. Any thoughts?

Thanks,
Dave


"Tom Ogilvy" wrote in message
...
If Target.Address = "$A$4" Then

or
If Target.Address(0,0) = "A4" Then

--
Regards,
Tom Ogilvy


"dave!!" wrote in message
...
I have a data validation list with a number of states in it. Each

time
I
select a new state I want 2 macros to run. The list is in cell A4 of

Sheet
1. Here is the code I am using at the worksheet level, can someone

tell
me
what I'm doing wrong?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "A4" Then
pp_maj_macro
pp_minor_macro
End If
End Sub

Thanks so much,
Dave








  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Validation List Question

The macros are in a module in the same workbook and there is no error
handling. The macros run if I select them, however they still do not run
when I select a new state. I am baffled.


"Tom Ogilvy" wrote in message
...
If the macros are in a general module in the same workbook, they should

run.

If they are not defined, you should get an error. Otherwise they should
run. It is possible you have error handling in the subs and that causes
them to appear not to run. Possibly Put message boxes at the top of each
sub.

--
Regards,
Tom Ogilvy


"dave!!" wrote in message
...
I put a message box in to verify that it's getting past the if

statement,
and that's working fine, but the macros aren't running. Any thoughts?

Thanks,
Dave


"Tom Ogilvy" wrote in message
...
If Target.Address = "$A$4" Then

or
If Target.Address(0,0) = "A4" Then

--
Regards,
Tom Ogilvy


"dave!!" wrote in message
...
I have a data validation list with a number of states in it. Each

time
I
select a new state I want 2 macros to run. The list is in cell A4

of
Sheet
1. Here is the code I am using at the worksheet level, can someone

tell
me
what I'm doing wrong?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "A4" Then
pp_maj_macro
pp_minor_macro
End If
End Sub

Thanks so much,
Dave










  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Validation List Question

Best I can offer is to take a look at the workbook if you want to email it.



--
Regards,
Tom Ogilvy

"dave!!" wrote in message
...
The macros are in a module in the same workbook and there is no error
handling. The macros run if I select them, however they still do not run
when I select a new state. I am baffled.


"Tom Ogilvy" wrote in message
...
If the macros are in a general module in the same workbook, they should

run.

If they are not defined, you should get an error. Otherwise they should
run. It is possible you have error handling in the subs and that causes
them to appear not to run. Possibly Put message boxes at the top of

each
sub.

--
Regards,
Tom Ogilvy


"dave!!" wrote in message
...
I put a message box in to verify that it's getting past the if

statement,
and that's working fine, but the macros aren't running. Any thoughts?

Thanks,
Dave


"Tom Ogilvy" wrote in message
...
If Target.Address = "$A$4" Then

or
If Target.Address(0,0) = "A4" Then

--
Regards,
Tom Ogilvy


"dave!!" wrote in message
...
I have a data validation list with a number of states in it. Each

time
I
select a new state I want 2 macros to run. The list is in cell A4

of
Sheet
1. Here is the code I am using at the worksheet level, can

someone
tell
me
what I'm doing wrong?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "A4" Then
pp_maj_macro
pp_minor_macro
End If
End Sub

Thanks so much,
Dave












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
Validation list question Gotroots Excel Discussion (Misc queries) 3 December 9th 09 05:16 PM
validation drop down list question [email protected] Excel Worksheet Functions 1 January 22nd 09 03:41 PM
Validation List/Formula Question JWNJ Excel Discussion (Misc queries) 2 February 5th 08 03:18 AM
Data Validation List Question wx4usa Excel Discussion (Misc queries) 1 October 13th 07 04:36 AM
Data Validation-List..Question? maperalia Excel Discussion (Misc queries) 4 July 12th 07 06:37 PM


All times are GMT +1. The time now is 04:35 PM.

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"