vendredi 20 septembre 2019

How can i put many values in 1 variable or in many variables?

Extracting RollerCoasters with Wood Only

            Sub RollerCoaster()

            Dim strType As String
            Dim blnLoop As Boolean
            Dim strCoaster As String

            strType = "Wood"

            Range("A2").Select
            blnLoop = True

            Do Until ActiveCell.Value = ""
                ActiveCell.Offset(1, 0).Select
                strType = ActiveCell.Offset(0, 2).Value

                    If strType = "Wood" Then
                        strCoaster = ActiveCell.Value
                        blnLoop = False
                    Else
                    End If

            Loop

            MsgBox ("The RollerCoaster that are made of Wood are " & strCoaster)

            End Sub

So I created a Sub that finds the rollercoaster made out of wood, and it displays which rollercoaster is made out of wood in a message box. However, how can I make my code display more than one rollercoaster, if I have more on the list. (Look at image)

Aucun commentaire:

Enregistrer un commentaire