Kamis, 02 April 2015

Re : [ExcelVBA] Simple loop help

 

Hello from France (:

Try 

in the loop  :

 ' first assigning ...

Cells(i,1).value = i

'after  here check each faces

if i = 11 then
                         Cells(i,1).value= "Jack"
end if

'  and so on for those not 1 to 10 ...

BYE


@++SC

Envoyé depuis Yahoo Mail pour Android


De:"jeff.flanagan@duffcorp.ca [ExcelVBA]" <ExcelVBA@yahoogroups.com>
Date:Ven j Avr AM à 5:18
Objet:[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: stephane cauvin <cauvin_stephane@yahoo.fr>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)
----------------------------------
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:

Poskan Komentar