Copy Column from one sheet to another

Malligai

Member
The below code is not working in BP. Can anyone help? it shows "Not delared/Not memeber" errors. Do i need to add any namespace.

Set objExcel = CreateObject("Excel.Application")

Set objWorkbook = objExcel.Workbooks.Open ("U:\XXXX")

objExcel.Visible = True

objWorkbook.Worksheets("XXSheetnameXX").Range("A1:A25").Copy
Set objWorkSheet = objWorkbook.Sheets.Add
objWorkBook.Worksheets("Sheet1").Range("A1").PasteSpecial -4163
objWorkBook.Worksheets("Sheet1").Range("C1").PasteSpecial -4163
objWorkBook.Worksheets("Sheet1").Range("B2:B25").Value = "0"
objWorkBook.Worksheets("Sheet1").Range("B1").Value = "BBB"
objWorkBook.Worksheets("Sheet1").Range("C1").Value = "CCC"
objWorkbook.Worksheets("Sheet1").Activate
 

VJR

Well-Known Member
Hi Malligai,

i. For copying data from one sheet to another use the 'Copy and Paste Worksheet Range' action of the Ms Excel VBO.

ii. To copy only the data without formulas you need to set the stages as below-
- 'Select' action to select the source worksheet and the source range that needs to be copied
- Then the 'Copy' action to copy the selected cells onto the clipboard
- Then the 'Activate Worksheet' for the destination sheet if you want to paste this data into another sheet
- 'Go to cell' for setting the location where you want to paste this data starting from
- 'Paste' action with 'Values Only' flag as True.

iii. If you want to make code changes then you can find some here
Post #26 - http://rpaforum.net/threads/find-last-row.1929/post-12850
Post #19 - http://rpaforum.net/threads/find-last-row.1929/post-12835
Post #2 - http://rpaforum.net/threads/how-to-paste-with-options-in-excel-using-blueprism.7994/post-13974
 
Top