Hej Mike
Er det dette du søger?
Jeg forudsætter, at du markerer x celler i en kolonne og der så undersøges
for, at der er en stigning på 1.
Option Explicit
Const increment As Long = 1
Const hil As String = "Best regards from Joergen."
'----------------------------------------------------------
' Procedure : TestIncOne
' Date : 20050502
' Author : Joergen Bondesen
' Purpose : Controle selection, only One column, for
' increment 1
'----------------------------------------------------------
'
Sub TestIncOne()
Dim rrange As Range
Set rrange = Selection
If rrange.Rows.Count = 1 Then
MsgBox "We can't controle ONE cell, sorry.", _
vbCritical, hil
GoTo endmacro
End If
If rrange.Columns.Count > 1 Then
MsgBox "We can only controle ONE column, sorry.", _
vbCritical, hil
GoTo endmacro
End If
Dim rrangeNew As Range
Set rrangeNew = rrange.Offset(1, 0) _
.Resize(rrange.Rows.Count - 1, 1)
Dim cell As Range
For Each cell In rrangeNew
If cell.Value - increment <> cell.Offset(-1, 0).Value Then
Range(cell.Address).Select
MsgBox "Error in increment in selected cell, not " _
& increment, vbCritical, hil
GoTo endmacro
End If
Next cell
endmacro:
Set rrange = Nothing
Set rrangeNew = Nothing
End Sub
--
Med venlig hilsen
Jørgen Bondesen
"Mike Johnson" <powerviper4@hotmail.com> wrote in message
news:708c71djeccpbafsjob632568fkonrnpqb@4ax.com...
> Hej
>
> Er der nogen som kan sige mig hvorledes jeg checker en celles værdi X
> rækker oppe ? (X er variabel og stiger med 1 hver gang man skifter til
> næste linie). Dette skal ske uden at man flytter fra den aktive celle.
>
> På forhånd tak
>
> MJ
--
I am using the free version of SPAMfighter for private users.
It has removed 401 spam emails to date.
Paying users do not have this message in their emails.
Try
www.SPAMfighter.com for free now!