[英]Excel2010/VBA: Store and Usage of Worksheet Variable during Userform Session
Hello and excuse my bumpy English. 您好,请原谅我坎English的英语。
Option Explicit Public GlbVarBaseSheet As String ------------ Sub Formularaufruf_Worksheet1() GlbVarBaseSheet = ActiveSheet.Name with Userform1 .MultiPage1.Value = 1 .Show 0 End With End Sub
Within the Userform, there´sa Sub Called Uebernahme, wich fills out the Textboxes reading the column number wich is stored in the .tag of the TextBox. 在用户窗体中,有一个名为Uebernahme的子文件夹,该文件夹将填充文本框,读取的列号将存储在文本框的.tag中。
How can i Use the Worksheet Variable in this line to use is during the Userform Session: This is not working and i don´t know why 我如何在用户窗体会话期间在此行中使用工作表变量:这不起作用,我不知道为什么
With Workbooks("KVP.xlsm").Worksheets(GlbVarBaseSheet)
The Full Sub: 完整子:
Sub Uebernahme() Dim Zeilenindex As Long Dim OBcB As MSForms.Control Dim VarTypeName As String Sheets(GlbVarBaseSheet).Activate ' ' ' Workbooks("KVP.xlsm").ActiveSheet.Rows(spinbutton1.Value).Activate Zeilenindex = spinbutton1.Value ' ' With Workbooks("KVP.xlsm").Worksheets(GlbVarBaseSheet) If .Cells(ActiveCell.Row, 1).Value <> "" Then For Each OBcB In MultiPage1.SelectedItem.Controls VarTypeName = TypeName(OBcB) If OBcB.Tag <> "" Then Select Case VarTypeName Case Is <> "Checkbox" 'OBcB.Value = .cells(Left(OBcB.Tag, 1) & ActiveCell.Row) OBcB.Value = .Cells(ActiveCell.Row, Int(Left(OBcB.Tag, 1))).Value End Select End If Next End If End With End Sub
Thanks in advance 提前致谢
尝试
dim GlbVarBaseSheet as Worksheet
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.