Copy and Paste Specific Cells from one worksheet to another

前端 未结 2 1802
南笙
南笙 2021-01-28 23:05

I have a spreadsheet Sheet1 I have a row with some cell values as shown in Image 1. I am having a problem trying to copy and paste cells from one worksheet to another in excel.

2条回答
  •  长发绾君心
    2021-01-28 23:43

    For the first cell on Sheet2, write:

    =Sheet1!A4
    

    Then the other two as follows:

    =Sheet1!D4
    =Sheet1!G4
    

    That is, if you want to have the same values even if you update the ones on Sheet1. If not, perhaps you want vba code? Create a new module:

    sub copy()
    
    dim sheet1 as Worksheet, sheet2 as Worksheet
    
    sheet1 = Worksheets("Sheet1")
    sheet2 = Worksheets("Sheet2")
    sheet2.Cells(1,"A").Value=sheet1.Cells(4,"A").Value
    sheet2.Cells(2,"A").Value=sheet1.Cells(4,"D").Value
    sheet2.Cells(3,"A").Value=sheet1.Cells(4,"G").Value
    
    end sub
    

提交回复
热议问题