遍历团队并使用子例程

Loop through teams and use sub routine

我必须 运行 在特定 sheet 的范围 a4:a13 中循环,这是团队名称 a-h。当此循环 运行 遍历团队名称时,我需要它 运行 我的其他代码,该代码目前仅适用于团队 A。我如何使用循环和子例程使其自动化,以便所有团队都可以使用它 运行,而无需复制代码

到目前为止我有

Sub Looproutine()

Dim i As Integer

Dim TeamName As String

TeamName = Sheets("Parametres")
("A"&(str(i)).value

For i = 4 To 13

Call tidydata(Team(i))

谢谢

看来你可以像下面这样:

Option Explicit

Sub Looproutine()

    Dim cell As Range

    For Each cell In Worksheets("Parametres").Range("A4:A13") '<~~ loop through every cell of your relevant range

        tidydata cell.Value '<~~ call "tidydata()" passing it the current cell value

    Next cell

End Sub