Roger
asked on
writing to a shapesheet section via CellsSRC - but from the bottom row upwards!
I hope I'll kick myself:
This code loads "test_1" through to "test_10" into Scratch column A.
Whilst debug.print shows a progression of values through a For loop from "test_1" to "test_10", the values appear in the scratch section with "test_10" on the first scratch row, and "test_1" on the last (bottom) row. Why? and How do I invert the order in the scratch rows?
--------
Sub Scratch()
Dim pag As Visio.Page
Dim shps As Visio.Shapes
Dim cel As Visio.Cell
Dim i As Integer
Dim str As String
Dim rowCount As Integer
Set pag = ActivePage
Set shps = pag.Shapes
str = "test_"
For i = 1 To 10
shps.ItemFromID(1).AddRow visSectionScratch, visRowScratch, 0
rowCount = shps.ItemFromID(1).rowCoun t(visSecti onScratch)
Set cel = shps.ItemFromID(1).CellsSR C(visSecti onScratch, visRowScratch, visScratchA)
cel.Formula = Chr(34) & str & i & Chr(34)
Debug.Print "shp.rowCount(visSectionSc ratch) = "; rowCount
Debug.Print "str & i = "; str & i
Next i
End Sub
--------
Kelvin4
This code loads "test_1" through to "test_10" into Scratch column A.
Whilst debug.print shows a progression of values through a For loop from "test_1" to "test_10", the values appear in the scratch section with "test_10" on the first scratch row, and "test_1" on the last (bottom) row. Why? and How do I invert the order in the scratch rows?
--------
Sub Scratch()
Dim pag As Visio.Page
Dim shps As Visio.Shapes
Dim cel As Visio.Cell
Dim i As Integer
Dim str As String
Dim rowCount As Integer
Set pag = ActivePage
Set shps = pag.Shapes
str = "test_"
For i = 1 To 10
shps.ItemFromID(1).AddRow visSectionScratch, visRowScratch, 0
rowCount = shps.ItemFromID(1).rowCoun
Set cel = shps.ItemFromID(1).CellsSR
cel.Formula = Chr(34) & str & i & Chr(34)
Debug.Print "shp.rowCount(visSectionSc
Debug.Print "str & i = "; str & i
Next i
End Sub
--------
Kelvin4
ASKER
Scott: Thanks for the quick note above,
The question is not a show-stopper, but seeks to improve my basic understanding.
I can wait til you are free
Best,
Kelvin,
The question is not a show-stopper, but seeks to improve my basic understanding.
I can wait til you are free
Best,
Kelvin,
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Many thanks
Kelvin
Kelvin
In the meantime, if anyone else gets to this first, that's fine with me.
Scott