Skip a value

Closed
prabinkaal Posts 1 Registration date Tuesday 19 November 2013 Status Member Last seen 19 November 2013 - 19 Nov 2013 à 12:55
TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 - 21 Nov 2013 à 10:50
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.

1 response

TrowaD Posts 2921 Registration date Sunday 12 September 2010 Status Contributor Last seen 27 December 2022 555
21 Nov 2013 à 10:50
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