![]() |
|
#2
|
||||
|
||||
|
The basic problem with your code is that you haven't enclosed your string variables in quotes. You also haven't dimensioned your 'i' variable and your code could be made more efficient. Try:
Code:
Sub group()
Dim i As Long
For i = 1 To 6
Select Case Range("a" & i).Value
Case "apple": Range("C" & i).Value = 1
Case "orange": Range("C" & i).Value = 2
Case "banana": Range("C" & i).Value = 3
End Select
Next i
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
How to total 12 columns and divide them to get a percentage
|
Triscia | Word Tables | 1 | 01-15-2013 07:39 AM |
formula divide by serio error
|
vthomeschoolmom | Excel | 1 | 04-18-2012 02:29 PM |
| divide page into 4 parts | aclark17 | Word | 4 | 01-17-2012 09:04 AM |
| Divide by zero error | doublejoy | Excel | 1 | 08-22-2009 03:10 AM |