作者:Yyao | 来源:互联网 | 2023-05-29 16:11
Thisismycode.Iamcountingthelicensesandineedthetotalnooflicensesofeachtypeinanot
This is my code. I am counting the licenses and i need the total no of licenses of each type in another sheet.
这是我的代码。我正在计算许可证,我需要在另一张表中完全不使用每种类型的许可证。
Sub Button1_Click()
'Initialising no of licenses to 0
Dim transientLicense As Integer
transientLicense = 0
Dim steadyLicense As Integer
steadyLicense = 0
Dim staticLicense As Integer
staticLicense = 0
'checking conditions
transientLicense = Sum(CountIfs(Channeltype, "'=Radial Vibration' Or '=Acceleration' Or '=Acceleration2' Or '=Velocity' Or '=Velocity'", Keyphasor, "=Yes", ActiveInactive, "=Active"))
steadyLicense = Sum(CountIfs(Channeltype, "'=Radial Vibration' Or '=Acceleration' Or '=Acceleration2' Or '=Velocity' Or '=Velocity'", Keyphasor, "=No", ActiveInactive, "=Active"))
staticLicense = Sum(CountIfs(Channeltype, "'=Thrust Position' Or '=Temperature' Or '=Pressure'", ActiveInactive, "=Active"))
Application.ScreenUpdating = False
Sheet2.Visible = xlSheetVisible
' changes the format of sheet 3 to text
'Sheet2.Cells.NumberFormat = "@"
Sheets("Sheet2").Activate
'Writes header
Sheet2.Select
Range("b2").Value = "Transient Licenses"
Range("c2").Value = "Steady Licenses"
Range("d2").Value = "Static Licenses"
'writes new table in sheet 2
Columns("B:B").Select
Selection.ColumnWidth = 20
Columns("C:C").Select
Selection.ColumnWidth = 20
Columns("D:D").Select
Selection.ColumnWidth = 20
End Sub
After clicking on the button, I want the ouput in sheet2. Can u please let me know how to get ouput in another worksheet. Thank u so much in advance. :)
点击按钮后,我想把它放在sheet2中。你能告诉我怎么把工作表填进去吗?提前谢谢你。:)
2 个解决方案