Bekijk de onderstaande video om te zien hoe je onze site als een web app op je startscherm installeert.
Opmerking: Deze functie is mogelijk niet beschikbaar in sommige browsers.
Privacywetgeving
Het is bij Helpmij.nl niet toegestaan om persoonsgegevens in een voorbeeld te plaatsen. Alle voorbeelden die persoonsgegevens bevatten zullen zonder opgaaf van reden verwijderd worden. In de vraag zal specifiek vermeld moeten worden dat het om fictieve namen gaat.
Ewoud, zou je toch op deze vraag willen antwoorden?En wat is het 'hogere doel' van deze oefening???
Groet, Leo
Sub getalleninvullen()
Dim dblBeginGetal As Double
Dim dblEindGetal As Double
Dim dblStep As Double
With Selection
dblBeginGetal = .Cells(1).Value
dblEindGetal = .Cells(1, .Columns.Count).Value
With .SpecialCells(xlCellTypeBlanks)
dblStep = (dblEindGetal - dblBeginGetal) / (.Cells.Count + 1)
.Formula = "=RC[-1]+" & Replace(dblStep, ",", ".")
.Value = .Value
End With
End With
End Sub
Sub getalleninvullen2()
Dim dblBeginGetal As Double
Dim dblEindGetal As Double
Dim dblStep As Double
Dim r As Range
With Selection
dblBeginGetal = .Cells(1).Value
dblEindGetal = .Cells(1, .Columns.Count).Value
With .SpecialCells(xlCellTypeBlanks)
dblStep = (dblEindGetal - dblBeginGetal) / (.Cells.Count + 1)
For Each r In .SpecialCells(xlCellTypeBlanks)
r.Value = r.Offset(0, -1).Value + dblStep
Next
End With
End With
End Sub
Ewoud0612, Naar mijn bescheiden mening is het resultaat van het gemiddelde van 1 en 10 niet 4,5 maar 5,5....Nog een vb:
3 cellen:
1e= "1"
2e= "leeg"
3e= "10"
Wanneer ik nu de macro uitvoer, moet in het 2e veld 4,5 komen staan.
Sub getalleninvullen2()
Dim dblBeginGetal As Double
Dim dblEindGetal As Double
Dim dblStep As Double
Dim r As Range
With Selection
dblBeginGetal = .Cells(1).Value
dblEindGetal = .Cells([COLOR="blue"][B].Rows.Count, 1[/B][/COLOR]).Value
With .SpecialCells(xlCellTypeBlanks)
dblStep = (dblEindGetal - dblBeginGetal) / (.Cells.Count + 1)
End With
For Each r In .SpecialCells(xlCellTypeBlanks)
r.Value = r.Offset([B][COLOR="Blue"]-1[/COLOR][/B]).Value + dblStep
Next
End With
End Sub
EDIT2: De ingesloten lus in de 2e with klopte niet.
Sub getalleninvullen2()
Dim dblBeginGetal As Double
Dim dblEindGetal As Double
Dim dblStep As Double
Dim r As Range
With Selection
dblBeginGetal = .Cells(1).Value
dblEindGetal = .Cells(1, .Columns.Count).Value
With .SpecialCells(xlCellTypeBlanks)
dblStep = (dblEindGetal - dblBeginGetal) / (.Cells.Count + 1)
For Each r In [B].Cells[/B]
r.Value = r.Offset(0, -1).Value + dblStep
Next
End With
End With
End Sub
We gebruiken essentiële cookies om deze site te laten werken, en optionele cookies om de ervaring te verbeteren.