View Full Version : Solved: how to know from which sheet a button was clicked??
PaSha
12-14-2007, 06:25 AM
hy people...
can i know from which sheet a button was clicked??
becouse i have 6 sheets and on every a button with the same name for ex. commandbutton1 ...
Bob Phillips
12-14-2007, 06:37 AM
You already have an active thread on this topic, DON'T start another needlessly!
PaSha
12-14-2007, 06:42 AM
sorry, but the question isn't the same...
Bob Phillips
12-14-2007, 06:44 AM
In what way is it not the same?
PaSha
12-14-2007, 06:47 AM
becouse in the previous thread i was asking: how the userform should know which button called her ...
now i am asking if it is posible to know from which sheet the button was clicked that called the userform ... becouse the last threadh was not solved, so i thought maybe i can do it like this ...
but however ...
mikerickson
12-14-2007, 06:50 AM
If a command button were to trigger a macro, wouldn't that button be on ActiveSheet?
PaSha
12-14-2007, 07:01 AM
yes you're right ... on this princip i was thinking
but when i use for ex.
If Worksheets("someSheet") = ActiveSheet Then
'perform action
End if
it brings me an error ... object doesn't support this property of method
so now i don't know is this posible or am i just using some bad syntax words for the code
mikerickson
12-14-2007, 07:05 AM
you compare two sheets with the IS comparison, not =. IS is for objects, = for values. (There are exceptions and quirks.)
If Worksheets("mySheet") Is ActiveSheet Then
or
If ActiveSheet.Name = "mySheet" Then
PaSha
12-14-2007, 07:17 AM
you compare two sheets with the IS comparison, not =. IS is for objects, = for values. (There are exceptions and quirks.)
If Worksheets("mySheet") Is ActiveSheet Then
or
If ActiveSheet.Name = "mySheet" Then
ok thanks ... it works ...
the second one works for me =) ...
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.