excelnoobhere
Board Regular
- Joined
- Mar 11, 2019
- Messages
- 61
I have the following code that copies the rows from one my source sheet to the other and gets rid of empty rows that don't have anything in column C.
I want to be able to run this so that if my target sheet has data to place it at the last empty row.
if possible, I also want it to check every row and that if row and all columns match then it wont copy it over. basically copies only updates from that source sheet.
I want to be able to run this so that if my target sheet has data to place it at the last empty row.
if possible, I also want it to check every row and that if row and all columns match then it wont copy it over. basically copies only updates from that source sheet.
Code:
'--------------------------------------Button1-------------------------------------------------Sub button1()
Dim sourceName As String
Dim targetName As String
Sheets("Master").Activate
' sourceName = Cells(13, "F").Value
sourceName = Cells(12, "F").Value
'sourceName = InputBox("What is the Project Number the we are pulling Data from?")
targetName = InputBox("What is the desired name for the New Tab that will be generated?")
Sheets.Add.Name = targetName
Sheets(sourceName).Activate
Sheets(sourceName).Columns(1).Copy Destination:=Sheets(targetName).Columns(1)
Sheets(sourceName).Columns(3).Copy Destination:=Sheets(targetName).Columns(2)
Sheets(sourceName).Columns(4).Copy Destination:=Sheets(targetName).Columns(3)
Sheets(sourceName).Columns(5).Copy Destination:=Sheets(targetName).Columns(4)
Sheets(sourceName).Columns(6).Copy Destination:=Sheets(targetName).Columns(5)
Sheets(sourceName).Columns(7).Copy Destination:=Sheets(targetName).Columns(6)
Sheets(targetName).Activate
On Error Resume Next
Columns("C").SpecialCells(xlCellTypeBlanks).EntireRow.Delete
End Sub