Hello VBA Experts
I have a workbook which contains 50+ worksheets, I want to copy Cells B1, K1 and L1 from each worksheet and paste it another worksheet ("OtherDatadump").
Also note that from this workbook few worksheets need to be excluded. These are with the names (Roles&Dropdowns, OtherDatadump, Summary, Consolidated Data, Project-SampleTemplate) in my workbook.
Can someone please help me?
I tried with below code, but this is not giving me desired results (For now I just tried to copy-paste cell K1).
Sub CopyPasteValuesFromAllWorkSheets()
Dim ws As Worksheet
Dim wb As Workbook
Dim lastrow1 As Long, lastrow2 As Long
Set wb = ThisWorkbook
For Each ws In wb.Worksheets
If ws.Name <> "Roles&Dropdowns" And ws.Name <> "OtherDatadump" And ws.Name <> "Summary" And ws.Name <> "Consolidated Data" And ws.Name <> "Project-SampleTemplate" Then
ws.Range("K1").copy
lastrow1 = ThisWorkbook.Sheets("OtherDatadump").Range("H" & Rows.Count).End(xlUp).Row
ThisWorkbook.Sheets("OtherDatadump").Range("I2" & lastrow1).PasteSpecial Paste:=xlPasteValues
End If
'NextIteration:
Next ws
Application.ScreenUpdating = True
End Sub
Bookmarks