B
Bill McKeever
I'm having trouble writing VBA code to manipulate Excel
workbook objects. For example, I want to rearrange
worksheet order. Why does the code in the first example
(below) work, whereas, the code in the second example
does not?
Sub Move_After10thSheet()
'This code works:
Sheets("Jun-12").Select
Sheets("Jun-12").Move After:=Sheets(10)
End Sub
-------------------------------------------------------
Sub Move_AfterTenthSheet()
'This code does not work:
Dim myString As String
arg = "Sheets(10)"
Sheets("Jun-12").Select
Sheets("Jun-12").Move After:=myString
End Sub
workbook objects. For example, I want to rearrange
worksheet order. Why does the code in the first example
(below) work, whereas, the code in the second example
does not?
Sub Move_After10thSheet()
'This code works:
Sheets("Jun-12").Select
Sheets("Jun-12").Move After:=Sheets(10)
End Sub
-------------------------------------------------------
Sub Move_AfterTenthSheet()
'This code does not work:
Dim myString As String
arg = "Sheets(10)"
Sheets("Jun-12").Select
Sheets("Jun-12").Move After:=myString
End Sub