mittels folgenden Codes fülle ich Koordinaten-Werte von Punkten in eine Variabel ab. Je drei Spalten enthalten die X-/Y- und Z-Werte. Alle Punkte pro Zeile bilden ein "Profil".
Das ganze funktioniert tadellos solange man einen zusammenhängenden Bereich auswählt. Nun soll es aber auch funktionieren wenn man z.B. die Werte der ersten, dritten und fünften Punkte, sprich Spalte A:C, G:I und M:O, auswählt.
Kann mir jemand einen Tipp geben wie ich eine solche Auswahl per For..Next auslesen kann.
Gruss und Dank
Hansruedi
**********************
Function GetSolidPoints() As Variant
Dim rngR As Range
Dim intRBreite As Integer
Dim intRHoehe As Integer
Dim intRSpalte As Integer
Dim intRZeile As Integer
Dim dblSolid() As Variant
Dim dblProfil() As Double
Dim intQP As Integer
Dim intSP As Integer
Dim i As Integer
Dim j As Integer
Dim k As Integer
Do
Set rngR = Application.InputBox("Bitte einen Bereich auswählen:" & vbNewLine _
& vbNewLine & "X-Koord, Y-Koord, Z-Koord", Title:="Koordinatenauswahl", Default:=ActiveWindow.RangeSelection.Address, Type:=8)
rngR.Select
intRHoehe = rngR.Rows.Count
intRBreite = rngR.Columns.Count
Loop Until intRBreite Mod 3 = 0 And intRHoehe >= 2
intRSpalte = rngR.Cells.Column
intRZeile = rngR.Cells.Row
intQP = intRBreite / 3
intSP = intRHoehe
ReDim dblSolid(intSP - 1)
ReDim dblProfil(2, intQP - 1)
For i = 0 To intSP - 1
For j = 0 To intQP - 1
dblProfil(0, j) = (rngR.Cells(i + 1, j * 3 + 1)) * 1000
dblProfil(1, j) = (rngR.Cells(i + 1, j * 3 + 2)) * 1000
dblProfil(2, j) = (rngR.Cells(i + 1, j * 3 + 3)) * 1000
Next
dblSolid(i) = ClosePoly(dblProfil)
Next i
GetSolidPoints = dblSolid
End Function
**********************