如何为一系列行设置固定行高?
我有一个macros为一系列行设置了一定的行高,如下所示:
Sub Set_Row_Height() ThisWorkbook.Sheets(1).Rows("7:3000").RowHeight = 50 End Sub
该macros按照预期工作,直到激活行范围内的选定单元格为止。 结果,行高变为15或20像素的较小高度。 下面是一个例子:
有一种方法可以防止单元格被激活时行高改变吗?
保护工作表和设置AllowFormattingRows:=False
将阻止用户调整行的大小。
Worksheets("Sheet1").Protect Password:="", AllowFormattingRows:=False, DrawingObjects:=False, Contents:=True, Scenarios:= _ False, AllowFormattingCells:=True, AllowFormattingColumns:=True, _ AllowInsertingColumns:=True, AllowInsertingRows:=True, _ AllowInsertingHyperlinks:=True, AllowDeletingColumns:=True, _ AllowDeletingRows:=True, AllowSorting:=True, AllowFiltering:=True, _ AllowUsingPivotTables:=True