Hi,
I've recorded a macro to follow simple steps of copying a part of a spreadsheet which has been filtered.
than to open a new workbook and dump it into worksheet 1 of A2..
simple enough, and it records no problems.
but when i attach this code to a button on the worksheet, i get error when it tries to opne a workbook and paste into A2...
the specific code of error is in bold? why? i altered to make it sheet("Sheet1").Active or something like that as i thought maybe to do with sheet not active or workbook keeps changing as if the user ran it again, it won't be workbook1 that it paste into as if its already used, it would be workbook2 (will the below still work) and can somoene help with the error in bold?
ActiveWindow.SmallScroll Down:=-6
With Application
.Calculation = xlManual
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
Range("K6:L6").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWindow.SmallScroll Down:=6
Selection.Copy
ActiveWindow.SmallScroll Down:=-15
Workbooks.Add
Sheets("Sheet1").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells.Select
Cells.EntireColumn.AutoFit
Selection.ColumnWidth = 50
Range("A2:B2").Select
Selection.Font.Bold = True
Range("A1").Select
ActiveWindow.SmallScroll Down:=-9
I've recorded a macro to follow simple steps of copying a part of a spreadsheet which has been filtered.
than to open a new workbook and dump it into worksheet 1 of A2..
simple enough, and it records no problems.
but when i attach this code to a button on the worksheet, i get error when it tries to opne a workbook and paste into A2...
the specific code of error is in bold? why? i altered to make it sheet("Sheet1").Active or something like that as i thought maybe to do with sheet not active or workbook keeps changing as if the user ran it again, it won't be workbook1 that it paste into as if its already used, it would be workbook2 (will the below still work) and can somoene help with the error in bold?
ActiveWindow.SmallScroll Down:=-6
With Application
.Calculation = xlManual
.MaxChange = 0.001
End With
ActiveWorkbook.PrecisionAsDisplayed = False
Range("K6:L6").Select
Range(Selection, Selection.End(xlDown)).Select
ActiveWindow.SmallScroll Down:=6
Selection.Copy
ActiveWindow.SmallScroll Down:=-15
Workbooks.Add
Sheets("Sheet1").Select
Range("A2").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Cells.Select
Cells.EntireColumn.AutoFit
Selection.ColumnWidth = 50
Range("A2:B2").Select
Selection.Font.Bold = True
Range("A1").Select
ActiveWindow.SmallScroll Down:=-9