是你要找的吗?
s = 1
For x = 0 To EleXML.ChildNodes.Length - 1
Range("A10").Offset(s, 0) = EleXML.ChildNodes.Item(x).getAttribute("aa")
Range("A10").Offset(s + 1, 0) = EleXML.ChildNodes.Item(x).getAttribute("bb")
Range("A10").Offset(s + 2, 0) = EleXML.ChildNodes.Item(x).getAttribute("cc")
s = s + 3
Next x
您可以通过记录代码来解决这个问题。
Sub Macro1()
'
' Macro1 Macro
'
'
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
With Selection
.HorizontalAlignment = xlRight
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub
试试这个。您可以根据需要进行调整。
With Range("A10").Offset(x, 0)
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With