这是我的代码。我正在计算许可证,我需要另一张表中每种类型的许可证总数。VBA EXCEL:我如何在另一张纸上输出
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
点击按钮后,我想要在sheet2中输出。 你可以让我知道如何在另一个工作表中获得输出。 提前感谢你。 :)
劳驾给反馈[此相关,你的前面的问题(http://stackoverflow.com/questions/41355766/VBA的Excel的操作方法 - 比较 - 内容的-A-细胞对特定的弦)。谢谢 – user3598756