Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looping a Select Case 1

Status
Not open for further replies.

joeyballz

IS-IT--Management
Mar 25, 2009
2
US
Hi I have a SQL query returning a status code to Excel that I need to convert to text i.e. 4 = sucess

There are 11 possibilities
Select Case Range("N6")
Case "1"
Range("G6").Value = "Running"
Case "2"
Range("G6").Value = "Starting"
--- etc
End Select

My problem is I need to run this on 135 cells and can not figure out how to loop this to run on each cell like the next row N7, G7 down to N135, G135 without actually writing the select case range for each cell.

Can any one give some guidence? Thanks.
 
Code:
For Each cell In Range("N2:N136")
    Select Case cell.Value
        Case 1
            cell.Offset(, -7) = "running"
        Case 2
            cell.Offset(, -7) = "starting"
        Case Else
    End Select
Next cell

[tt][blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top