I first saw an Excel spreadsheet three days ago, so this is a real beginner's question. I recorded a simple macro to select data from five (non-consecutive) cells in a row in one workbook, enter the data in the appropriate place in a second workbook, and then colour the source cells in the first workbook yellow as a reference. That all works well. But when I try to have the macro move down to the next row in the first workbook containing data that I want before it (the macro) ends, so that I don't have to use the mouse at all and can just keep hitting the keyboard command, I get run-time error 1004. So, most of all I'd like to know how to make this macro work. I'd also appreciate advice, though it's less critical, on how to make the macro loop through the process X times for X rows, so that the whole process would only take one keyboard command. That would be very satisfying.
Thanks in advance, and this is the VBA code for the macro with the extra step that doesn't work:
Sub Macro4()
'
' Macro4 Macro
'
' Keyboard Shortcut: Ctrl+f
'
ActiveCell.Offset(26, -4).Range("A1,C1,E1").Select
ActiveCell.Offset(26, 0).Range("A1").Activate
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 4
ActiveCell.Offset(0, -4).Range("A1,C1,E1,G1,I1").Select
ActiveCell.Offset(0, 4).Range("A1").Activate
Selection.Copy
Windows("Target EXPERIMENTAL.xlsx").Activate
ActiveSheet.Paste
ActiveCell.Offset(1, 0).Range("A1").Select
Windows("Source EXPERIMENTAL.xls").Activate
Application.CutCopyMode = False
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
.PatternTintAndShade = 0
End With
ActiveWindow.SmallScroll Down:=3
ActiveWindow.ScrollColumn = 3
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 1
ActiveWindow.SmallScroll Down:=21
ActiveCell.Offset(27, -8).Range("A1").Select
End Sub
Bookmarks