View Full Version : Solved: how can i change this code to identifiy the 2 digit no?
rrosa1
06-12-2010, 06:43 AM
hi
how can i change this code to identify the 2 digit no
day1 = "1"
With ws1
For i = .Cells(.Rows.Count, 1).End(xlUp).Row To 8 Step -1
If InStr(1, .Cells(i, 2).Value, day1) = 1 Then
.Cells(i, 2).EntireRow.Delete
End If
Next i
End With
this code work untill if the cell value is one digit but if it 11,12,13,14,15,16,17,18,19 than also it delete the row how can i change that not to delete those row?
hi
how can i change this code to identify the 2 digit no...
this code work untill if the cell value is one digit but if it 11,12,13,14,15,16,17,18,19 than also it delete the row how can i change that not to delete those row?
This seems confusing. Until/if woulld seem to be opposite, you start by askking to identify 'the 2 digit no', but then say you do not want to delete these rows.:wot
How about giving us some sample data of what we are likely to encounter in the cells, and which would be deleted and which not?
Mark
rrosa1
06-12-2010, 07:21 AM
i have following value in column B
Days
1 <- i want to delete this row
2
4
3
1 <-this row
5
2
6
1 <-this row
19
1 <-and this row
not the 19 row but it delete 19 row also i hope i am explain that can be understandable
thanks for help.
Tinbendr
06-12-2010, 07:36 AM
how about With ws1
For i = .Cells(.Rows.Count, 1).End(xlUp).Row To 8 Step -1
If Len(.Cells(i, 2).Value) = 1 Then
If InStr(1, .Cells(i, 2).Value, day1) = 1 Then
.Cells(i, 2).EntireRow.Delete
End If
End If
Next i
End With
Bob Phillips
06-12-2010, 07:40 AM
Why not just use
With ws1
For i = .Cells(.Rows.Count, 1).End(xlUp).Row To 8 Step -1
If .Cells(i, 2).Value = 1 Then
.Rows(i).Delete
End If
Next i
End With
rrosa1
06-12-2010, 08:06 AM
thanks for help
Tinbender and XLD
it work great
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.