|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub Test()
- Dim shSource As Worksheet
- Dim arr As Variant, strTemp As String, strSplit() As String
- Dim intLen As Integer, lngRow As Long
-
- Set shSource = Sheets("Sheet1")
- lngRow = shSource.Range("A" & Rows.Count).End(xlUp).Row
-
- arr = shSource.Range("A1:A" & lngRow)
- For lngRow = 2 To 21
- strTemp = arr(lngRow, 1)
- strSplit = Split(strTemp, Chr(10))
- intLen = Len(strSplit(0))
- With shSource.Range("A" & lngRow).Characters(1, intLen).Font
- .Bold = True
- .Size = 14
- End With
- Next
-
- End Sub
复制代码 |
|