range or string or long type
On 7 nov, 15:54, Gary''s Student
wrote:
Nest the IFs to test rng5 against nothing first and the value of rng5 inside
the first IF.
Don't use "is" to test rng5 against "a", use something like:
If rng5.Value="a" then
rng5.EntireRow.Delete
End If
The above will only work if rng5 is a single cell
--
Gary''s Student - gsnu2007a
"bartman1980" wrote:
I've made this code but with this line he gives an error because the
types of rng5 doesn't match.
If Not rng5 Is Nothing Or rng5 Is "a" Then
Does somebody know how I can combine the 2 functions with the OR?
This is my code:
Dim Walternatief As Long
Dim Wbenodigde As Long
Dim rng5 As Range
Range("A:A").Select
Selection.Find(What:="alternatief", After:=ActiveCell,
LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False) _
.Select
Walternatief = Selection.Row
Dim rng4 As Range
On Error Resume Next
Set rng4 = ActiveSheet.Range("F" & WOptioneel + 1 & ":F" &
Walternatief - 6).SpecialCells(xlBlanks)
On Error GoTo 0
If Not rng4 Is Nothing Then
rng4.EntireRow.Delete
End If
Range("A:A").Select
Selection.Find(What:="Benodigde", After:=ActiveCell,
LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False) _
.Select
Wbenodigde = Selection.Row
On Error Resume Next
Set rng5 = ActiveSheet.Range("F" & Walternatief + 1 & ":F" &
Wbenodigde - 1).SpecialCells(xlBlanks)
On Error GoTo 0
If Not rng5 Is Nothing Or rng5 Is "a" Then
rng5.EntireRow.Delete
End If- Tekst uit oorspronkelijk bericht niet weergeven -
- Tekst uit oorspronkelijk bericht weergeven -
Hi Don, Ian and Gary,
Hi Don,
I already tried your versions.
But all give the same error: types aren't the same
I think it has to do with the type of rng5.
The range is only one cell.
|