I've got a problem with some data I want to compare and copy, from one xls-file to another xls-file. That I hope someone can help me with.
I've made a macro, that can copy the data I want copied. But now there's more then one row to copy, and it's not sure that all the data need's to be copied. So the macro must be able to compare the data, and if the data is the same in the given row, it should not copy that the data, but continue to the next row. Until al the rows a compared.
Here is det code I've made. (This just copies the data.):
Sub Bank1Slot1()
'
' Bank1Slot1 Macro
' Macro recorded 17-11-2008 by Godfasher
'
' Keyboard Shortcut: Ctrl+a
'
Workbooks.Open Filename:= _
"C:\Bank1.xls"
Sheets("Slot1").Select
Rows("6:6").Select
Selection.Insert Shift:=xlDown
Windows("PVE LAB TEST OVERVIEW.xls").Activate
Range("D5:H5").Select
Selection.Copy
Windows("Bank1.xls").Activate
Range("B6").Select
ActiveSheet.Paste
Range("H6").Select
Application.CutCopyMode = False
ActiveCell.FormulaR1C1 = "=RC[-1]-RC[-2]"
Range("H6").Select
Selection.NumberFormat = "0"
Range("C6:G6").Select
Range("G6").Activate
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("B6").Select
With Selection
.HorizontalAlignment = xlLeft
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A1").Select
Sheets("Slot1").Select
Range("A1").Select
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
Looking forward to hear from you.
/Godfasher
Bookmarks