- Joined
- Jul 17, 2009
- Messages
- 1
- Reaction score
- 0
I have a macro that Will select a pair of ranges from one sheet and pastes them into a new sheet. It works just fine in Office XP but for some reason in Office 2003 instead of pasting the selected and copied range, it pastes the entire first sheet. Does anyone know what has changed? Here is my code:
Sub Exports()
Application.DisplayAlerts = False
Range("X1").Select
lrowdn = ActiveCell.Value
Range("X2").Select
fileToOpen = ActiveCell.Value
'ChDir "C:\EBS"
If Range("E3").Value > 0 Then Range("A3:A" & lrowdn & ",X3:X" & lrowdn).Select _
Else: Range("A3:A" & lrowdn & ",U3:U" & lrowdn).Select
Range("A3").Activate
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
Columns("A:A").Select
Selection.NumberFormat = "0"
Columns("B:B").Select
Selection.ColumnWidth = 30
Selection.NumberFormat = "0.00000"
ActiveWorkbook.SaveAs Filename:=Left(fileToOpen, Len(fileToOpen) - 4), FileFormat:=xlCSV, _
CreateBackup:=False
ActiveWindow.Close
Range("U3").Select
ActiveWindow.SmallScroll ToLeft:=2
ActiveWorkbook.Save
End Sub
Sub Exports()
Application.DisplayAlerts = False
Range("X1").Select
lrowdn = ActiveCell.Value
Range("X2").Select
fileToOpen = ActiveCell.Value
'ChDir "C:\EBS"
If Range("E3").Value > 0 Then Range("A3:A" & lrowdn & ",X3:X" & lrowdn).Select _
Else: Range("A3:A" & lrowdn & ",U3:U" & lrowdn).Select
Range("A3").Activate
Selection.Copy
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
Columns("A:A").Select
Selection.NumberFormat = "0"
Columns("B:B").Select
Selection.ColumnWidth = 30
Selection.NumberFormat = "0.00000"
ActiveWorkbook.SaveAs Filename:=Left(fileToOpen, Len(fileToOpen) - 4), FileFormat:=xlCSV, _
CreateBackup:=False
ActiveWindow.Close
Range("U3").Select
ActiveWindow.SmallScroll ToLeft:=2
ActiveWorkbook.Save
End Sub