Kamis, 02 April 2015

RE: [ExcelVBA] Simple loop help

 

Hi jeff,

I tested your code, and it works when I test it.  What errors are you getting?

 

Tim



 

From: ExcelVBA@yahoogroups.com [mailto:ExcelVBA@yahoogroups.com]
Sent: Thursday, April 02, 2015 8:10 PM
To: ExcelVBA@yahoogroups.com
Subject: [ExcelVBA] Simple loop help

 

 

Hi All,

Having difficulty running this loop. I am try to determine the integer value of a cell to return its card rank. i.e. 2=2

9=9

11=Jack

12=Queen

etc...

Here is the code, but I get multiple errors.

 

Private Sub RankCheck()

Dim i As Integer, CurrentCell As Long


For i = 1 To 52
    CurrentCell = Cells(i, 1)
        If Int(CurrentCell) = 11 Then
            Cells(i, 2).Value = "Jack"
        ElseIf Int(CurrentCell) = 12 Then
            Cells(i, 2).Value = "Queen"
        ElseIf Int(CurrentCell) = 13 Then
            Cells(i, 2).Value = "King"
        ElseIf Int(CurrentCell) = 14 Then
            Cells(i, 2).Value = "Ace"
        Else: Cells(i, 2).Value = Int(CurrentCell)
        End If
Next i

End Sub

 

 

Any help is appreciated. 

__._,_.___

Posted by: "Tim Lewis" <twlewis@reagan.com>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)
----------------------------------
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.

----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA

----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com

----------------------------------

.

__,_._,___

Tidak ada komentar:

Posting Komentar