這是我的代碼。我正在計算許可證,我需要另一張表中每種類型的許可證總數。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