kweaver
Well-known Member
- Joined
- May 12, 2009
- Messages
- 2,934
- Office Version
- 365
- 2010
Fluff, in addition to the comma mess I'm having (another post), I'm having a problem with your MOVE function.
This worked perfectly fine in my previous situation where the names were in the S column. In a new file, the names are now in the U column.
In my test case, there's only 1 name in U5, but I get an error on Sheets(Ary).Move that the move method of sheet class failed.
Nothing has changed from your original (below) other than S is now U in the new application.
Am I just going crazy? (well, don't answer that).
Code:
Sub MoveSheets()
Dim UsdRws As Long, i As Long
Dim Cl As Range
Dim Ary As Variant
With Sheets("TextFile")
UsdRws = .Range("U" & Rows.Count).End(xlUp).Row
ReDim Ary(UsdRws - 5)
For Each Cl In .Range("U5:U" & UsdRws)
Ary(i) = Cl.Value
i = i + 1
Next Cl
End With
Sheets(Ary).Move
End Sub
This worked perfectly fine in my previous situation where the names were in the S column. In a new file, the names are now in the U column.
In my test case, there's only 1 name in U5, but I get an error on Sheets(Ary).Move that the move method of sheet class failed.
Nothing has changed from your original (below) other than S is now U in the new application.
Code:
Sub MoveSheets()
Dim UsdRws As Long, i As Long
Dim Cl As Range
Dim Ary As Variant
With Sheets("TextFile")
UsdRws = .Range("S" & Rows.Count).End(xlUp).Row
ReDim Ary(UsdRws - 5)
For Each Cl In .Range("S5:S" & UsdRws)
Ary(i) = Cl.Value
i = i + 1
Next Cl
End With
Sheets(Ary).Move
End Sub
Am I just going crazy? (well, don't answer that).