Example:
Rows : D E F G
Replace by : 1 1 2 2
Find : BlankblankBlankBlank
我想設兩個for next同時執行並同時改變變數,例如第一個for next去d行到g行,第二個for next,尋找d到g行的所有"blank"並replce by "1 to 2",
for z=1 to 10 step 2
for z1= 1 to 2
Cell(3+z).select
Selection.Replace What:="blank", Replacement:="&z1&",LookAt:=xlPart,_
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Cell(4+z).select
Selection.Replace What:="blank", Replacement:="&z1&",LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Next z
Next Z1
有冇方法可以同時改變z,z1的變數,然再重覆執行next迴圈.
唔該晒各位