I need to copy tan color cells from one workbook and paste into another workbook. and need to take only specific cells values in that excel. I achieved that, but only able to paste into another sheet in same workbook. Can you please help me in pasting the data to another workbook on a specific sheet and that too the values should be pasted in second row,(i.e starting from second row) as first row has title in it.
Source Table Titles:
Project | Phase | Status | st Dt | End Dt | Pre | resource | Remark | Comments
Dest Table Title:
Project | Phase | st Dt | End Dt | resource |
Existing Code:
Option Explicit
Sub CopyRowsGroup()
Dim wks As Worksheet
Dim wNew As Worksheet
'Dim y As Workbook
Dim lRow As Long
Dim lNewRow As Long
Dim x As Long
Dim ptr As Long
Set wks = ActiveSheet
lRow = wks.Cells.SpecialCells(xlCellTypeLastCell).Row
Set wNew = Worksheets.Add
'Set y = Workbooks.Open("C:\Users\1519728\Desktop\Capacity Planning Tracker-ver1.0.xlsx")
'Workbooks.Open("C:\Users\1519728\Desktop\Capacity Planning Tracker-ver1.0.xlsx").Activate
'Set wNew = y.Sheets("Data dump")
lNewRow = 1
For x = 1 To lRow
If wks.Cells(x, 1).Interior.Color = RGB(221, 217, 195) Then
wks.Cells(x, 1).EntireRow.Copy
wNew.Cells(lNewRow, 1).PasteSpecial Paste:=xlPasteValues
lNewRow = lNewRow + 1
End If
Next
wNew.Rows([1]).EntireRow.Delete
wNew.Columns([3]).EntireColumn.Delete
wNew.Columns([3]).EntireColumn.Delete
wNew.Columns([5]).EntireColumn.Delete
wNew.Columns([6]).EntireColumn.Delete
wNew.Columns([6]).EntireColumn.Delete
wNew.Columns([6]).EntireColumn.Delete
For ptr = 2 To lNewRow - 2
If Cells(ptr, "A") = vbNullString Then
Cells(ptr, "A") = Cells(ptr, "A").Offset(-1, 0)
End If
Next
End Sub