View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default Simple VBA code not working on new laptop

You have in two places X1 instead of Xl (one instead of the letter l).

Sub OpOutOfSequence()

Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
End Sub


"Alex" wrote:

I have the following code that is working fine on my PC, but I just got a new
laptop and it stops working on the line "ActiveSheet.Paste". I don't know
where to begin to look. Security is set to low. Thanks for your help.

Sub OpOutOfSequence()

Range("A1").Select
Range(Selection, Selection.End(x1ToRight)).Select
Range(Selection, Selection.End(x1down)).Select
Selection.Copy
Workbooks.Add
ActiveSheet.Paste