How to to paste inside for loop?

dmadhup

Board Regular
Joined
Feb 21, 2018
Messages
146
Office Version
  1. 365
Hi,

I am seeking help pasting the copied value inside for loop in the following code. But complaining at line:

.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False

Any help, please. thanks


Code:
Dim lastIrow As Long
lastIrow = Cells(Rows.count, "I").End(xlUp).Row
Dim i As Long, j As Long, cl As Range, rng As Range, add As Range
For i = 6 To lngEndRow Step 1
            With Sheets("Sheet1")
                .Range("N" & i & ":U" & i).Copy
            End With
            Worksheets("Sheet2").Activate
            
            ActiveSheet.Range("B17:AB50").AutoFilter Field:=8, Criteria1:=Range("I16")
            
            Set rng = Range("K18:K" & lastIrow).SpecialCells(xlCellTypeVisible)
           
            For Each cl In rng
                 .PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
            Next cl


    End With


Next i
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Where do you want to paste those cells values? The code doesn't say.
 
Upvote 0
I have also tried this to paste on K cells but no luck.

Code:
            Dim last As Long
            For Each cl In rng
                last = Cells(Rows.count, "K").End(xlUp).Row
                Range("K" & last).Select
                 Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
            Next cl
 
Upvote 0

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top