VBA如何设置行高输入行单元格内最大行号设置的高度

时间:2018-11-02 11:38:31

标签: vba excel-vba

嗨,我正在动态行高中工作。第2行填写VBA动态。如何在以下行高度中设置409动态。第2行“从A2到AV2”输入行集,其中在第2行中设置了行高的单元格最大行数可用。我完成了单元格2数据修复。高度如何细化最大细胞系数目如何在细胞高度中排列。

Sub CallChildDate()

Dim i As Integer
Dim Dim s1,s2,s3,s11,s12,s13,s21,s22,s23,s32,s31,s33,s41,s42,s43,s51,s52,s53,s611,s621,s631,s61,s62,s63,s71,s72,s73,s81,s82,s83,s91,s92,s93,s101,s102,s103,s111,s112,s113,s121,s122,s123 As string

i = 2
s1 = "A" & i
s2 = "C" & i
S3 = "" & s1 & " : " & s2 & ""

s11 = "D" & i
S12 = "F" & i
S13 = "" & s11 & " : " & S12 & ""

s21 = "G" & i
s22 = "I" & i
S23 = "" & s21 & " : " & s22 & ""


s31 = "J" & i
s32 = "L" & i
S33 = "" & s31 & " : " & s32 & ""

s41 = "M" & i
s42 = "O" & i
S43 = "" & s41 & " : " & s42 & ""

s51 = "P" & i
s52 = "Z" & i
S53 = "" & s51 & " : " & s52 & ""

s611 = "AA" & i
s621 = "AB" & i
S631 = "" & s611 & " : " & s621 & ""

s61 = "AC" & i
s62 = "AD" & i
S63 = "" & s61 & " : " & s62 & ""

s71 = "AE" & i
s72 = "AG" & i
S73 = "" & s71 & " : " & s72 & ""

s81 = "AH" & i
s82 = "AJ" & i
S83 = "" & s81 & " : " & s82 & ""

s91 = "AK" & i
s92 = "AM" & i
S93 = "" & s91 & " : " & s92 & ""

s101 = "AN" & i
s102 = "AP" & i
S103 = "" & s101 & " : " & s102 & ""

s111 = "AQ" & i
s112 = "AS" & i
S113 = "" & s111 & " : " & s112 & ""


s121 = "AT" & i
s122 = "AV" & i
S123 = "" & s121 & " : " & s122 & ""



Worksheets("Spec Runner").Range(S3).Merge

Worksheets("Spec Runner").Range(S3).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S3).HorizontalAlignment = xlCenter

Worksheets("Spec Runner").Range(S13).Merge
Worksheets("Spec Runner").Range(S13).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S13).HorizontalAlignment = xlCenter

Worksheets("Spec Runner").Range(S23).Merge
Worksheets("Spec Runner").Range(S23).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S23).HorizontalAlignment = xlCenter

Worksheets("Spec Runner").Range(S33).Merge
Worksheets("Spec Runner").Range(S33).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S33).HorizontalAlignment = xlCenter

Worksheets("Spec Runner").Range(S43).Merge
Worksheets("Spec Runner").Range(S43).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S43).HorizontalAlignment = xlCenter

Worksheets("Spec Runner").Range(S53).Merge
Worksheets("Spec Runner").Range(S53).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S53).HorizontalAlignment = xlLeft

Worksheets("Spec Runner").Range(S631).Merge
Worksheets("Spec Runner").Range(S631).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S631).HorizontalAlignment = xlCenter

Worksheets("Spec Runner").Range(S63).Merge
Worksheets("Spec Runner").Range(S63).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S63).HorizontalAlignment = xlCenter

Worksheets("Spec Runner").Range(S73).Merge
Worksheets("Spec Runner").Range(S73).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S73).HorizontalAlignment = xlCenter

Worksheets("Spec Runner").Range(S83).Merge
Worksheets("Spec Runner").Range(S83).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S83).HorizontalAlignment = xlCenter

Worksheets("Spec Runner").Range(S93).Merge
Worksheets("Spec Runner").Range(S93).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S93).HorizontalAlignment = xlCenter

Worksheets("Spec Runner").Range(S103).Merge
Worksheets("Spec Runner").Range(S103).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S103).HorizontalAlignment = xlCenter

Worksheets("Spec Runner").Range(S113).Merge
Worksheets("Spec Runner").Range(S113).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S113).HorizontalAlignment = xlCenter

Worksheets("Spec Runner").Range(S123).Merge
Worksheets("Spec Runner").Range(S123).VerticalAlignment = xlCenter
Worksheets("Spec Runner").Range(S123).HorizontalAlignment = xlCenter

'Worksheets("Spec Runner").Rows(i).RowHeight = 80.25

Dim a1 As String
Dim a2 As String
a1 = "A" & i
a2 = "AV" & i

Range(a1, a2).Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlSolid
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlSolid
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlSolid
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With
With Selection.Borders(xlInsideVertical)
.LineStyle = xlSolid
.ColorIndex = xlAutomatic
.TintAndShade = 0
End With

'END

'DATA ASSIGN IN CELL

Sheets(1).Cells(2, 1).Value = "2/10/2018"
Sheets(1).Cells(2, 4).Value = "DAY"
Sheets(1).Cells(2, 7).Value = "FL1"
Sheets(1).Cells(2, 7).WrapText = True
Sheets(1).Cells(2, 10).Value = "Oil pump motor"
Sheets(1).Cells(2, 10).WrapText = True
Sheets(1).Cells(2, 13).Value = "TESTING DATA"
Sheets(1).Cells(2, 13).WrapText = True
Sheets(1).Cells(2, 16).Value = "To disassemble cable power supply of Oil pump Draw stand 1, and Calender 2  for Maintenance interchange to use original motor pump complete set for same spec original design. Today we take out cable finish under maintenance follow up."
Sheets(1).Cells(2, 16).WrapText = True
Sheets(1).Cells(2, 27).NumberFormat = "@"
Sheets(1).Cells(2, 27).Value = "11:90"
Sheets(1).Cells(2, 29).NumberFormat = "@"
Sheets(1).Cells(2, 29).Value = "12:00"
Sheets(1).Cells(2, 31).Value = "Test Description"
Sheets(1).Cells(2, 31).WrapText = True
Sheets(1).Cells(2, 34).Value = "Pradit K., Theerawan K., Boonriang P."
Sheets(1).Cells(2, 34).WrapText = True
Sheets(1).Cells(2, 37).Value = "Repair"
Sheets(1).Cells(2, 40).Value = "Routine"
Sheets(1).Cells(2, 43).Value = "Not yet"
Sheets(1).Cells(2, 46).Value = "Follow up"

End Sub

enter image description here

如何设置行高固定。

0 个答案:

没有答案