Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet change sub procedure
Hi there,
The following sub procedu Private Sub Worksheet_Change(ByVal Target As Range) Target does not appear to be a Range object. I can't use it like Target.value or iMyInteger = RcCell Is Target or anything that would require an Object type. Any ideas? Grant. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet change sub procedure
Grant,
The Target argument is indeed a range reference. What exactly do you mean when you say you can't "use it"? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Grant" wrote in message ... Hi there, The following sub procedu Private Sub Worksheet_Change(ByVal Target As Range) Target does not appear to be a Range object. I can't use it like Target.value or iMyInteger = RcCell Is Target or anything that would require an Object type. Any ideas? Grant. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet change sub procedure
Type mismatch error for msgbox Target.value
-----Original Message----- Grant, The Target argument is indeed a range reference. What exactly do you mean when you say you can't "use it"? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Grant" wrote in message ... Hi there, The following sub procedu Private Sub Worksheet_Change(ByVal Target As Range) Target does not appear to be a Range object. I can't use it like Target.value or iMyInteger = RcCell Is Target or anything that would require an Object type. Any ideas? Grant. . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet change sub procedure
Hi Grant,
I could reproduce your situation with an unintentional error entry (e.g. =25/0) or an intentional error entry such as =NA(). In these special situations what value can the sub return other than a run-time error? The following should demonstrate Target.Value does return the value of the Target range object if there is a legitimate value to return and does return the address of the Target range irrespective of the Target entry. This is consistent with Target being a range object. Private Sub Worksheet_Change(ByVal Target As Range) If Not IsError(Target.Value) Then MsgBox Target.Value End If MsgBox Target.Address End Sub At the risk of overkill, Activecell is clearly a range object but try this and see what happens: Sub Tester() ActiveCell.Value = 25 / 0 MsgBox ActiveCell.Value End Sub --- Regards, Norman "Grant" wrote in message ... Type mismatch error for msgbox Target.value -----Original Message----- Grant, The Target argument is indeed a range reference. What exactly do you mean when you say you can't "use it"? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Grant" wrote in message ... Hi there, The following sub procedu Private Sub Worksheet_Change(ByVal Target As Range) Target does not appear to be a Range object. I can't use it like Target.value or iMyInteger = RcCell Is Target or anything that would require an Object type. Any ideas? Grant. . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet change sub procedure
Try
Msgbox Target(1).Value -- Regards, Tom Ogilvy "Grant" wrote in message ... Type mismatch error for msgbox Target.value -----Original Message----- Grant, The Target argument is indeed a range reference. What exactly do you mean when you say you can't "use it"? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Grant" wrote in message ... Hi there, The following sub procedu Private Sub Worksheet_Change(ByVal Target As Range) Target does not appear to be a Range object. I can't use it like Target.value or iMyInteger = RcCell Is Target or anything that would require an Object type. Any ideas? Grant. . |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheet change sub procedure
Hi Tom,
A much more likely scenario! Thank you. --- Regards, Norman "Tom Ogilvy" wrote in message ... Try Msgbox Target(1).Value -- Regards, Tom Ogilvy "Grant" wrote in message ... Type mismatch error for msgbox Target.value -----Original Message----- Grant, The Target argument is indeed a range reference. What exactly do you mean when you say you can't "use it"? -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Grant" wrote in message ... Hi there, The following sub procedu Private Sub Worksheet_Change(ByVal Target As Range) Target does not appear to be a Range object. I can't use it like Target.value or iMyInteger = RcCell Is Target or anything that would require an Object type. Any ideas? Grant. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Validation Procedure with a worksheet change event | Excel Worksheet Functions | |||
Procedure to change Column heading from R1C1 to A1? | Excel Worksheet Functions | |||
Worksheet/General Procedure problem | Excel Discussion (Misc queries) | |||
WHAT IS THE PROCEDURE TO CHANGE CURENCY IN THE INVOICE WINDOW | Excel Discussion (Misc queries) | |||
Using VBA to track changes in a worksheet - help! Event procedure?? | Excel Programming |