作者:乔山办公网日期:
返回目录:excel表格制作
按所要求的行高与列宽要求制作成模板文件,新建文件时,以此模板为基础建立即可。
2003版中 1像素zhidao=0.75磅(行高值),27像素版=20.25, 28像素=21, 29像素=21.75.
30像素=22.5 ...... 行高的调整最小单位是1像素,当你输入权行高是21时,正好等于28像素。当你输入22时,实际值可能就是21.75。
' 任意一个单元格输入数字后,相应行行高设定为该数值的vba 代码(批量改变时,最右边的有效):e799bee5baa6e58685e5aeb9337
Private Sub Worksheet_Change(ByVal Target As Range)
Dim strVal As String
For Each c In Target
strVal = c.Value
If IsNumeric(strVal) Then
Rows(c.Row).RowHeight = strVal
End If
Next
End Sub
' 特定列变化时才改变行高的vba代码(这里为第一列):
Private Sub Worksheet_Change(ByVal Target As Range)
Dim strVal As String
For Each c In Target
strVal = Cells(c.Row, 1)
If IsNumeric(strVal) Then
Rows(c.Row).RowHeight = strVal
End If
Next
End Sub
' 代码写入方法:右击工作表名(如Sheet1),选择查看代码,把上面的其中一个代码拷进去,保存就行了