我有一个Access程序,它从ERP中获取2个不同的相关导出csv报告,并在excel输出上读取和创建。我想让excel拥有更好的网格线,这些网格线在“格式化单元格”中已知。然后'边境'然后点击'大纲'和' Inside'这使得阅读更容易。
我想如果我可以将其添加到我创建的excel输出的代码中。
Do Until mydeptset.EOF
mypos = mydeptset.AbsolutePosition
If mypos > 0 Then
If Int(mypos / 10) > 0 Then
If mypos Mod 10 = 0 Then
m = 2
n = k + 5
.Activate
.Range("A1:AF5").Select
myxls.Selection.Copy
.Range("A" & CStr(n)).Select
.Paste
.Range("A" & n + 3 & ":AF" & CStr(n + 3)).Clear
mydtset.MoveFirst
n = n + 5
k = n
Do Until mydtset.EOF
.Cells(k, 1) = mydtset!dt
mydtset.MoveNext
k = k + 1
Loop
.Cells(k, 1) = "Tot"
.Cells(k, 1).HorizontalAlignment = 2
.Cells(k, 1).Font.Bold = True
End If
End If
Else
n = 4
mydtset.MoveFirst
m = 2
k = 6
Do Until mydtset.EOF
.Cells(k, 1) = mydtset!dt
mydtset.MoveNext
k = k + 1
Loop
.Cells(k, 1) = "Tot"
.Cells(k, 1).HorizontalAlignment = 2
.Cells(k, 1).Font.Bold = True
End If
If n = 4 Then
k = 4
Else
k = n - 2
End If
.Cells(k, m) = mydeptset!drname
With .Cells(k, m)
.Font.Bold = True
.Font.Size = 8
.HorizontalAlignment = 1
End With
答案 0 :(得分:0)
.Range("A1:B6").Borders.LineStyle=1