简体   繁体   中英

Copy a specific cell data into column of other sheet

I have two worksheets, named "Monthly" and "Index", in a workbook.

In Index, cell A1 will have a value after some calculations.

I need to copy that value into "Monthly" Column "J".

It shall be one by one using next row coding.

Private Sub CommandButton2_Click()    
Dim i As Integer    
a = Worksheets("Monthly").Cells(Rows.Count, 1).End(xlUp).Row

For i = 2 To a    
    Range("K" & i).Copy Worksheets("Rule of 78").Range("D6")       
    'Range("A1").Offset(i - 1, 0).Copy Range("C1")    
    Range("I" & i).Copy Worksheets("Rule of 78").Range("D7")    
    Range("E" & i).Copy Worksheets("Rule of 78").Range("D8")    
    Range("A" & i).Copy Worksheets("Rule of 78").Range("D10")    
    Worksheets("Index").Range("C2").Copy " How to paste in Monthly sheet 
    column J, for every row, C2 is different"
Next i    

End Sub

Does "A1" have a formula? If so Excel is probably copying a formula, thus the error.

Try:

Worksheets("Index").Range("A1").Copy
Worksheets("Monthly").Range("J" & i).PasteSpecial xlPasteValues

Edit: "A1" or "C2", I didn't get wich is giving you the error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM