我必须在特定表单上的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))
由于
答案 0 :(得分:1)
好像你可以这样:
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