I have been working on this VBA program for a while now and I finally got it to function but a new challenge was added. As of now this program opens an excel sheet (wb1) and copies a large range of data to another excel sheet (wb2). I need it to mark the last column (T) of a row as "saved" in wb1 after it copies and then on the next run, disregard the rows that are marked "saved" in wb1. I posted this problem in another forum with no responses. http://www.ozgrid.com/forum/showthre...803#post635803.
Sub CopyData_Good()
Application.ScreenUpdating = False
Set wb1 = Workbooks("Good.xlsm")
Set ws1 = wb1.Sheets("Good1_Data")
Set wb2 = Workbooks("OverallData.xlsm")
Set ws2 = wb2.Sheets("All Good Data")
Dim rngCopyFromRange As Range
Set rngCopyFromRange = ws1.Range("A2:T1500") '- name the copy range for ease of read
Dim rngPasteStartCell As Range
Set rngPasteStartCell = ws2.Range("A" & ws2.Range("A" & ws2.Rows.Count).End(xlUp).Row + 1) 'top left cell to begin the paste
Dim lCurrentColumn As Long
Dim lCurrentRow As Long
For lCurrentColumn = 1 To rngCopyFromRange.Columns.Count 'for each column in the source data
For lCurrentRow = 1 To rngCopyFromRange.Rows.Count '-for each row in each column in source data
'set the offset of the starting cell's value equal ot the top left cell in the source data offset by the same amount
'- where the offsets are equal to the row/column we are on - 1
rngPasteStartCell.Offset(lCurrentRow - 1, lCurrentColumn - 1).Value = _
rngCopyFromRange.Cells(1, 1).Offset(lCurrentRow - 1, lCurrentColumn - 1).Value
Next lCurrentRow
Next lCurrentColumn
Application.ScreenUpdating = True
wb2.Save
End Sub
Bookmarks