ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Refer to a worksheet from a userform (https://www.excelbanter.com/excel-programming/368113-refer-worksheet-userform.html)

leonidas[_49_]

Refer to a worksheet from a userform
 

Hi,

I have a commandbutton(1) on a worksheet. When I click on this
commandbutton(1) a userform will show.
When I click on the commandbutton(2) OK on this userform it should look
for the name of the worksheet I clicked commandbutton(1). The code is
below. The only problem is, nothing happens.
Can someone help me solve this problem? Thanks in advance!


Code:
--------------------
Private Sub CommandButton1_Click()

If ActiveSheet.Name = "Begroting Calc Won" Then
Application.OnTime Now, "BegrotingWVBWonMaken"
Else
If ActiveSheet.Name = "Begroting Calc Uti" Then
Application.OnTime Now, "BegrotingWVBUtiMaken"
End If
End If

End Sub
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile: http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=564242


Bob Phillips

Refer to a worksheet from a userform
 
Works fine for me (XP, XL 2002)

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"leonidas" wrote in
message ...

Hi,

I have a commandbutton(1) on a worksheet. When I click on this
commandbutton(1) a userform will show.
When I click on the commandbutton(2) OK on this userform it should look
for the name of the worksheet I clicked commandbutton(1). The code is
below. The only problem is, nothing happens.
Can someone help me solve this problem? Thanks in advance!


Code:
--------------------
Private Sub CommandButton1_Click()

If ActiveSheet.Name = "Begroting Calc Won" Then
Application.OnTime Now, "BegrotingWVBWonMaken"
Else
If ActiveSheet.Name = "Begroting Calc Uti" Then
Application.OnTime Now, "BegrotingWVBUtiMaken"
End If
End If

End Sub
--------------------


--
leonidas
------------------------------------------------------------------------
leonidas's Profile:

http://www.excelforum.com/member.php...o&userid=35375
View this thread: http://www.excelforum.com/showthread...hreadid=564242





All times are GMT +1. The time now is 11:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com