作者:乔山办公网日期:
返回目录:excel表格制作
以下的这抄些表达式都是可以的.
指定在sheet1的A1单元zd格赋值
sheets("sheet1").range("A1")=userform1.textbox1.text
sheets("sheet1").cells(1,1)=userform1.textbox1.text
sheets("sheet1").[a1]=userform1.textbox1.text
在当前工作表的A1单元格赋值
activesheet.range("A1")=userform1.textbox1.text
activesheet.cells(1,1)=userform1.textbox1.text
activesheet.[a1]=userform1.textbox1.text
你这个是不是第一次弹出userform1,关闭后,到了指定时间,后面再分别弹出userform5,userform6,userform7.而你后面一直是取的UserForm1.TextBox中的值,后面userform1一直不在show的状态,所以你的string1,string2,string3都取不值,也就弹不出5,6,7三个窗口了.我改了下,你试试.
Sub aa()
If bl Then End
UserForm1.TextBox1 = Format(Time, "hh:mm:ss")
If (Now - t1) * 3600 * 24 > 120 Then
UserForm1.TextBox2 = "00:00:00"
string1 = "00:00:00" '这里加一个
Else
UserForm1.TextBox2 = Format(TimeValue("00:02:00") - Time + t, "hh:mm:ss")
string1 = Format(TimeValue("00:02:00") - Time + t, "hh:mm:ss") '这里加一个
End If
''string1 = CStr(UserForm1.TextBox2) '原位7a686964616fe4b893e5b19e336置
If Int(Left(string1, 2)) = 0 And Int(Mid(string1, 4, 2)) = 0 Then
UserForm1.TextBox2.ForeColor = 255
If flag1 Then
UserForm5.Show
flag1 = False
End If
End If
If (Now - t1) * 60 * 24 > 3 Then
UserForm1.TextBox3 = "00:00:00"
string2 = "00:00:00" '这里加一个
Else
UserForm1.TextBox3 = Format(TimeValue("00:03:00") - Time + t, "hh:mm:ss")
string2 = Format(TimeValue("00:03:00") - Time + t, "hh:mm:ss") '这里加一个
End If
'string2 = CStr(UserForm1.TextBox3) '原位置
If Int(Left(string2, 2)) = 0 And Int(Mid(string2, 4, 2)) = 0 Then
UserForm1.TextBox3.ForeColor = 255
If flag2 Then
UserForm6.Show
flag2 = False
End If
End If
If (Now - t1) * 24 > 1 Then
UserForm1.TextBox4 = "00:00:00"
string3 = "00:00:00" '这里加一个
Else
UserForm1.TextBox4 = Format(TimeValue("01:00:00") - Time + t, "hh:mm:ss")
string3 = Format(TimeValue("01:00:00") - Time + t, "hh:mm:ss") '这里加一个
End If
'string3 = CStr(UserForm1.TextBox4) '原位置
If Int(Left(string3, 2)) = 0 And Int(Mid(string3, 4, 2)) = 0 Then
UserForm1.TextBox4.ForeColor = 255
If flag3 Then
UserForm7.Show
flag3 = False
End If
End If
End Sub
试试
dim showfrom as userform6
set showfrom = new userform6
showfrom.show
双击来thisworkbook.
在自workbook_open事件中百加入度UserForm1.Visible,如下问:答
Private Sub Workbook_Open()
UserForm1.Visible
End Sub