我使用查询搜索出发和目的地的出行,并检查是否有空位,我还想输出可用的免费座位数,但无法计算如何从{减去结果{1}}和max_seats
类似于taken_seats
free_seats
答案 0 :(得分:1)
你可以这样使用
Sub freezesheet()
'set variable for the naming of the new sheet
Dim newname As String
'assignes our open variable to a designated value
Sheets("Sheet1").Activate
newname = Sheets("Sheet1").Range("C2").Value
'copies the sheet to a new sheet after the designated tab
Sheets("Sheet1").Copy after:=Sheets(3)
ActiveSheet.Name = newname
'unprotects the sheet so we can copy and paste as values
ActiveSheet.Unprotect "1"
'makes all of the formulas on the sheets into values and returns you to the original sheet
Cells.Select
selection.Copy
selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
'Re-protects sheet to ensure that we don't make changes to historical data.
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowFormattingCells:=True, AllowFormattingColumns:=True, _
AllowFormattingRows:=True
Sheets("Sheet1").Activate
End Sub
mysql支持查询列之间的减法。