Copying data to a new spreed sheet - "Run time error 1004"

Snuffepuff

New Member
Joined
Aug 27, 2014
Messages
9
Hi,

I´ve recorded a macro that basiclly creates a new spreed sheet and copys over the data (format and values only) and saves it in the new one.

Everything workes fine until I tried to run it on another computer, then I get the message Run-time error "1004" and I´ve no idea whats wrong.

Code:
Sub Expor()
'
' Export Macro
'


'
    Application.ScreenUpdating = False
    Workbooks.Add
    ActiveWorkbook.SaveAs Filename:="C:\Offert test.xlsx", FileFormat:= _
        xlOpenXMLWorkbook, CreateBackup:=False
    Windows("Offert.xlsm").Activate
    Range("D5:BE70").Select
    Selection.Copy
    Windows("Offert test.xlsx").Activate
    Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
        , SkipBlanks:=False, Transpose:=False
    Range("A1").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Cells.Select
    Cells.EntireColumn.AutoFit
    Cells.EntireRow.AutoFit
    Cells.EntireRow.AutoFit
    Cells.EntireColumn.AutoFit
    Selection.ColumnWidth = 46.29
    Cells.EntireColumn.AutoFit
    Cells.EntireRow.AutoFit
    Range("B5").Select
    Application.CutCopyMode = False
    ActiveWorkbook.Save
    Windows("Offert.xlsm").Activate
    ActiveWindow.ScrollColumn = 38
    ActiveWindow.ScrollColumn = 37
    ActiveWindow.ScrollColumn = 29
    ActiveWindow.ScrollColumn = 1
    ActiveWindow.SmallScroll Down:=-75
    Application.ScreenUpdating = True
End Sub
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.

Forum statistics

Threads
1,222,436
Messages
6,166,020
Members
452,008
Latest member
Customlogoflipflops

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top