Skip a value

Closed
prabinkaal Posts 1 Registration date Tuesday November 19, 2013 Status Member Last seen November 19, 2013 - Nov 19, 2013 at 12:55 PM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Nov 21, 2013 at 10:50 AM
suppose a1 a2 a3 = john,michel, robert, respectively and b1,b2,b3=10,9,10 then from values of b cell i wanted to print name in g cell who have corresponding values in b 10 only . i don't want to print name corresponding to 9. my problem is that the blank cell appears between g1 and g3............. so i want g3 value in g2............ please help me out.
Related:

1 response

TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 552
Nov 21, 2013 at 10:50 AM
Hi Prabinkaal,

I would advise you to use a header and then use the following code for best result:
Sub RunMe()
Dim lRow As Integer
lRow = Range("B1").End(xlDown).Row
For Each cell In Range("B2:B" & lRow)
If cell = 10 Then cell.Offset(0, -1).Copy _
Range("G" & Rows.Count).End(xlUp).Offset(1, 0)
Next cell
End Sub

Best regards,
Trowa
0