Set MyAimRangeF = Worksheets("sheet1").Range("F7:F2817")
改成:
Set MyAimRangeF = Worksheets("sheet1").Range("F7:F"&Sheet1.[A65536].End(xlUp).Row)
或者:
Set MyAimRangeF = Worksheets("sheet1").Range("F7:F" & n)
这样就可以了:
Set MyAimRangeF = Worksheets("sheet1").Range("F7:F" & n)
range("f7:f"&n)
N是变量,要变成"& N &"