dangky47h
Thành viên thường trực
![](/diendan/data/PhoToDanhHieu/gold.gif)
![](/diendan/data/PhoToDanhHieu/gold.gif)
![](/diendan/data/PhoToDanhHieu/gold.gif)
![](/diendan/data/PhoToDanhHieu/gold.gif)
- Tham gia
- 4/9/17
- Bài viết
- 341
- Được thích
- 41
- Giới tính
- Nam
Em có dử dụng code định dạng bảng trong diễn đàn, Code đó như sau:
Sub FormatCif()
Application.ScreenUpdating = False
Dim data(), i As Long, t, n As Long
t = Timer
n = [D65536].End(xlUp).Row
Range("A" & n + 1 & ":Z65536").Clear
With [A1:Z3]
.Borders(xlInsideVertical).LineStyle = 1
.Borders(xlEdgeTop).LineStyle = 1
.Borders(xlEdgeLeft).LineStyle = 1
.Borders(xlEdgeRight).LineStyle = 1
.Borders(xlInsideHorizontal).LineStyle = 2
End With
With [A2]
.NumberFormat = "00"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
[A2:Z2].Copy
Range("A3:Z" & n).PasteSpecial 4
[A1:Z2].Borders(xlInsideHorizontal).LineStyle = 1
Range("A" & n & ":Z" & n).Borders(xlEdgeBottom).LineStyle = 1
n = n - 1
ReDim data(1 To n, 1 To 1)
For i = 1 To n
data(i, 1) = i
Next
[A2].Resize(n).Value2 = data
Application.ScreenUpdating = True
MsgBox Timer - t
End Sub
Em muốn đường ở định dạng bảng thay đổi như hình ảnh sau:
Mong Các Thầy, Anh Chị giúp Em mới Ạ!
Sub FormatCif()
Application.ScreenUpdating = False
Dim data(), i As Long, t, n As Long
t = Timer
n = [D65536].End(xlUp).Row
Range("A" & n + 1 & ":Z65536").Clear
With [A1:Z3]
.Borders(xlInsideVertical).LineStyle = 1
.Borders(xlEdgeTop).LineStyle = 1
.Borders(xlEdgeLeft).LineStyle = 1
.Borders(xlEdgeRight).LineStyle = 1
.Borders(xlInsideHorizontal).LineStyle = 2
End With
With [A2]
.NumberFormat = "00"
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
End With
[A2:Z2].Copy
Range("A3:Z" & n).PasteSpecial 4
[A1:Z2].Borders(xlInsideHorizontal).LineStyle = 1
Range("A" & n & ":Z" & n).Borders(xlEdgeBottom).LineStyle = 1
n = n - 1
ReDim data(1 To n, 1 To 1)
For i = 1 To n
data(i, 1) = i
Next
[A2].Resize(n).Value2 = data
Application.ScreenUpdating = True
MsgBox Timer - t
End Sub
Em muốn đường ở định dạng bảng thay đổi như hình ảnh sau:
![434443.jpg 434443.jpg](https://www.giaiphapexcel.com/diendan/data/attachments/156/156126-57255ddee39446da75ee44f9567c7f9b.jpg?hash=VyVd3uOURt)
Mong Các Thầy, Anh Chị giúp Em mới Ạ!