How to paste data from specific cell to the entire column in another workbook.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shalskedar
    New Member
    • Sep 2009
    • 66

    #1

    How to paste data from specific cell to the entire column in another workbook.

    I need to copy data from 1 workbook & paste to another workbook which i could do.. but i m not able to paste the data starting from the specific cell...


    Below is my code
    Code:
    Dim wbk As Workbook
    strSecondFile = "c:\\v.xls"
    ThisWorkbook.Sheets("Sheet2").Range("F:F").Copy
    
    Set wbk = Workbooks.Open(strSecondFile)
    With wbk.Sheets("Sheet1")
         Range("C:C").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _
            False, Transpose:=False
    End With
    End Sub

    The problem here is in my target workbook column i want to start paste values from cell "C7"..

    whereas for the code above the values r been pasted from "C2" itself..which should not be the case..

    It should start paste from "C7" to the entire column below..

    Can anyone Plz help me with some solution.
  • TheSmileyCoder
    Recognized Expert Moderator Top Contributor
    • Dec 2009
    • 2322

    #2
    From what I see and understand of your code, your copying column F to column C in your target workbook. I dont see C2 or C7 mentioned anywhere.

    I dont think you can copy a column, to something other then a column. In order to achieve what you want, you must select a subset of a column.

    For selection: (Excel has a max row of 65536 (256^2). Lets assume you dont need all 65536 rows.
    Code:
    thisworkbook.sheets(1).range("F1:F64000").copy
    And then paste, starting in Cell C7
    Code:
    wbk.sheets(1).range("C7").pastespecial

    Comment

    Working...