By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,115 Members | 898 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,115 IT Pros & Developers. It's quick & easy.

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

P: 66
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
Expand|Select|Wrap|Line Numbers
  1. Dim wbk As Workbook
  2. strSecondFile = "c:\\v.xls"
  3. ThisWorkbook.Sheets("Sheet2").Range("F:F").Copy
  4.  
  5. Set wbk = Workbooks.Open(strSecondFile)
  6. With wbk.Sheets("Sheet1")
  7.      Range("C:C").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:= _
  8.         False, Transpose:=False
  9. End With
  10. End Sub
  11.  

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.
Nov 24 '10 #1
Share this Question
Share on Google+
1 Reply


TheSmileyCoder
Expert Mod 100+
P: 2,321
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.
Expand|Select|Wrap|Line Numbers
  1. thisworkbook.sheets(1).range("F1:F64000").copy
And then paste, starting in Cell C7
Expand|Select|Wrap|Line Numbers
  1. wbk.sheets(1).range("C7").pastespecial
Nov 24 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.