Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Good code not working???

The object with this code is that in either of the
worksheets, if the user enters "100" in M15, and "120" in
M16, the message comes up. Nothing happens when these
test values are entered. Furhter, there are no error
messages. Can someone help with this? Does the value in
the MyArray have anything to do with it?

Sub Descending_Values()

Dim MyArray() As Integer
ReDim MyArray(3) ' or, the maximum characters in the
target cells
MyArray(3) = 3

If (Worksheets("1. Customer").[M15] < [M16] Or _
Worksheets("2. Financial").[M15] < [M16]) Then
MsgBox "Target cannot be greater than Chart Max"
End If
End Sub

Thanks, Phil
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 80
Default Good code not working???

If this is a change event, what would the code be?
-----Original Message-----
What is supposed to make Descending_Values run. If you

want it to validate
an entry when it is made, you would have to trigger it

with the change
event.

If you run the macro as written through

Tools=Macro=Macros, does the
msgbox appear when it detects a situation in which you

would expect it to
appear?

--
Regards,
Tom Ogilvy

"Phil Hageman" wrote in message
...
I added the "fully qualify" syntax and the error

condition
is still allowed - with no error messages concerning
code. As for the array, I did that in response to a
previous error/help solution. I have eliminated the

array
stuff, and here is what I have:

Sub Descending_Values()


If (Worksheets("1. Customer").[M15] < Worksheets("1.
Customer").[M16] Or _
Worksheets("2. Financial").[M15] < Worksheets("2.
Financial").[M16]) Then
MsgBox "Target cannot be greater than Chart Max"
End If
End Sub

This code is located in Module1 of the workbook, and
operates on two (Cust, Fin) workksheets of ten in the
workbook.

What can I do next?

Phil


-----Original Message-----
Phil,

You need to fully qualify all cell references with the

worksheet
reference:

If (Worksheets("1. Customer").[M15] < _
Worksheets("1. Customer").[M16] Or _
Worksheets("2. Financial").[M15] < _
Worksheets("2. Financial").[M16]) Then
MsgBox "Target cannot be greater than Chart Max"
End If

Does the value in
the MyArray have anything to do with it?

You aren't using the array anywhere in the code. Why is

it even
there?


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Phil Hageman" wrote in message
...
The object with this code is that in either of the
worksheets, if the user enters "100" in M15,

and "120"
in
M16, the message comes up. Nothing happens when

these
test values are entered. Furhter, there are no error
messages. Can someone help with this? Does the

value
in
the MyArray have anything to do with it?

Sub Descending_Values()

Dim MyArray() As Integer
ReDim MyArray(3) ' or, the maximum characters in the
target cells
MyArray(3) = 3

If (Worksheets("1. Customer").[M15] < [M16] Or _
Worksheets("2. Financial").[M15] < [M16]) Then
MsgBox "Target cannot be greater than Chart

Max"
End If
End Sub

Thanks, Phil


.



.

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
And in case I don't see you,good afternoon,good evening,and good n msnyc07 Excel Discussion (Misc queries) 1 June 1st 10 11:24 AM
General tips for good code formatting NDBC Excel Discussion (Misc queries) 3 August 12th 09 07:36 AM
Excel drag down formula not working good.. zoola ander Excel Worksheet Functions 1 May 9th 08 08:51 AM
Excel drag down formula not working good.. zoola Excel Worksheet Functions 1 May 8th 08 11:04 PM
Macro lookup is not working good? TooN Excel Discussion (Misc queries) 5 September 14th 06 05:26 PM


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