View Single Post
 
Old 05-20-2013, 08:17 AM
tomlam tomlam is offline Windows 7 64bit Office 2007
Advanced Beginner
 
Join Date: Oct 2012
Posts: 33
tomlam is on a distinguished road
Default how to divide into group

Dear Sir/Madam

if apple, orange ,banana in column a
then column c will show as file

apple=1
orange=2
banana=3

but the follow programme don't work, how to do
Code:
Sub group()
For i = 1 To 6
  If Range("a" & i).Value = apple Then
    Range("C" & i).Value = 1
  End If
Next i
For i = 1 To 6
  If Range("a" & i).Value = orange Then
    Range("C" & i).Value = 2
  End If
Next i
For i = 1 To 6
  If Range("a" & i).Value = banana Then
    Range("C" & i).Value = 3
  End If
Next i
End Sub
Thanks
Tom
Attached Files
File Type: xls apple.xls (26.0 KB, 13 views)

Last edited by macropod; 05-20-2013 at 04:38 PM. Reason: Added code tags & formatting
Reply With Quote