Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following was already coded:
Dim srcProgramSummaryTemplateWs As Worksheet Set srcProgramSummaryTemplateWs = Sheets("@TemplateProgramSummary") I want to change the following €œIf€ statement to test for a second condition: Currently it states: If Target.Address = "$K$1" Then I would also like to test that the ActiveSheet < srcProgramSummaryTemplateWs Neither of these work: If Target.Address = "$K$1" & ActiveSheet < srcProgramSummaryTemplateWs Then If Target.Address = "$K$1" And ActiveSheet < srcProgramSummaryTemplateWs Then What is the correct context... |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You have objects and reference to boject won't work in terms of = or < Try
this If Target.Address = "$K$1" And ActiveSheet.name < srcProgramSummaryTemplateWs.Name -- HTH... Jim Thomlinson "CRayF" wrote: The following was already coded: Dim srcProgramSummaryTemplateWs As Worksheet Set srcProgramSummaryTemplateWs = Sheets("@TemplateProgramSummary") I want to change the following €œIf€ statement to test for a second condition: Currently it states: If Target.Address = "$K$1" Then I would also like to test that the ActiveSheet < srcProgramSummaryTemplateWs Neither of these work: If Target.Address = "$K$1" & ActiveSheet < srcProgramSummaryTemplateWs Then If Target.Address = "$K$1" And ActiveSheet < srcProgramSummaryTemplateWs Then What is the correct context... |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
many thanks
|
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi CRayF,
To render the code functional, try: If Target.Address = "$K$1" And ActiveSheet.Name < srcProgramSummaryTemplateWs.Name Then However, if this code is not part of an event procedure, then Target should probably be replaced with a range expression - possibly, ActiveCell. If the code forms part of a worksheet event procedure, then the active sheet will be the sheet holding the code, so it should be unnecessary to include a sheet identification condition. If the code forms part of a Workbook sheet event, the reference to Activesheet can be replaced with an assignment to the event's sh argument. If you need further assistance, it would be helpful if you could indicate if you are working with an event procedure and where the code is placed. --- Regards, Norman "CRayF" wrote in message ... The following was already coded: Dim srcProgramSummaryTemplateWs As Worksheet Set srcProgramSummaryTemplateWs = Sheets("@TemplateProgramSummary") I want to change the following "If" statement to test for a second condition: Currently it states: If Target.Address = "$K$1" Then I would also like to test that the ActiveSheet < srcProgramSummaryTemplateWs Neither of these work: If Target.Address = "$K$1" & ActiveSheet < srcProgramSummaryTemplateWs Then If Target.Address = "$K$1" And ActiveSheet < srcProgramSummaryTemplateWs Then What is the correct context... |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thanks again,
All works "Norman Jones" wrote: Hi CRayF, To render the code functional, try: If Target.Address = "$K$1" And ActiveSheet.Name < srcProgramSummaryTemplateWs.Name Then However, if this code is not part of an event procedure, then Target should probably be replaced with a range expression - possibly, ActiveCell. If the code forms part of a worksheet event procedure, then the active sheet will be the sheet holding the code, so it should be unnecessary to include a sheet identification condition. If the code forms part of a Workbook sheet event, the reference to Activesheet can be replaced with an assignment to the event's sh argument. If you need further assistance, it would be helpful if you could indicate if you are working with an event procedure and where the code is placed. --- Regards, Norman "CRayF" wrote in message ... The following was already coded: Dim srcProgramSummaryTemplateWs As Worksheet Set srcProgramSummaryTemplateWs = Sheets("@TemplateProgramSummary") I want to change the following "If" statement to test for a second condition: Currently it states: If Target.Address = "$K$1" Then I would also like to test that the ActiveSheet < srcProgramSummaryTemplateWs Neither of these work: If Target.Address = "$K$1" & ActiveSheet < srcProgramSummaryTemplateWs Then If Target.Address = "$K$1" And ActiveSheet < srcProgramSummaryTemplateWs Then What is the correct context... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Testing for conditions with IF statement and AND function | Excel Worksheet Functions | |||
If Statement On Two Conditions | Excel Worksheet Functions | |||
why can i use 3 conditions in SQL statement only? | Excel Programming | |||
Testing for Multiple Conditions | Excel Discussion (Misc queries) | |||
testing more than one variable in an if statement | Excel Discussion (Misc queries) |