Copy data column from closed workbook with vba

Copy data column from closed workbook with vba

Dinesh Kumar Takyar

8 лет назад

9,478 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Anand Shetty
Anand Shetty - 21.06.2021 12:16

HI, the code is good and i copied a couple of columns from another sheet, but the date column turns to text after it is pulled in new sheet. can you suggest.

Ответить
محمد أبو عبدو
محمد أبو عبدو - 26.05.2020 08:02

Thank You So Mutch, Sir.

Ответить
crazy graphic
crazy graphic - 24.10.2018 15:32

how i can filter data before copy

Ответить
kittipop trisinsomboon
kittipop trisinsomboon - 20.09.2018 13:07

Thank you.

Anyway, I still have a question. How to paste the value with format?

Ответить
Mike Kleinsteuber
Mike Kleinsteuber - 27.08.2018 12:55

Get syntax error on line 1 every time

Ответить
Ankur Khera
Ankur Khera - 07.01.2018 00:00

Hi Sir,
I am working on a project which requires data copying from a closed workbook which has few sheets; however, I needs to copy data from following sheets - Vodafone, Airtel, Idea.
There are 12 columns in each sheet; however, I need to copy data from 2nd row of each sheet to the end.
Since the file will be stored in a server, it will be good if I use browse function to open/set workbook from which I need to copy the data.

Below is the code:-

Sub Browse_Current_Roster()

Dim myfile As String
Dim xlApp As Application
Dim xlBook As Workbook
Dim Sh As Object
Dim LastRow_3 As Long

LastRow= ThisWorkbook.Sheets("Current_Roster").Cells(Rows.Count, 1).End(xlUp).Row

myfile = Application.GetOpenFilename(, , "Browse for current roster file")
ThisWorkbook.Sheets("Current_Roster").Range("A6") = myfile

Set xlApp = CreateObject("Excel.Application")
Set xlBook = Workbooks.Open("myfile")


xlBook.Sheets("Vodafone").Range("A2" & LastRow_3).Copy
Set xlBook = ActiveWorkbook
Set Sh = xlBook.Sheets("Current_Roster")
Range("B6").Select
Sh.Paste

End Sub

Pls help

Ответить
Fred M.
Fred M. - 05.12.2017 03:06

Hello Takyar, I got the error “Excel is waiting for another application to complete an OLE action.”

What would you recommend I try doing?

Ответить
Karanam Srinivas
Karanam Srinivas - 03.12.2017 11:09

Dear Takyar, it is wonderful video. I have two questions ..1. How do I copy dynamic columns or entire columns with specific names? 2.I want a dynamic path for source workbook, not the constant path.Appreciate your help in this regard.

Ответить
Abdorrahman O.
Abdorrahman O. - 21.12.2016 00:11

Dear Mr Takyar,

First of all, thank you very much for your videos! There are very useful !

I am currently trying to used this particular code to reach my target (updating a specific workbook based on input data contained in some other workbooks). By default, the code of an active x button is registered in the sheet level. When I am trying to run the code while kept in this section, I am getting an error message (Error 1004 "Application-defined or Object-defined error"). After some Googling, I found out that putting the code into the Modules section makes it working; which is the case for me as well. Now the problem I have is that the code is no more linked to the button but I have to run the code from VBA console. Is there any way to link the button to a code placed in the module section?

In advance, many thanks for your help!
With my best regards,

Ответить
Yoshua Sirait
Yoshua Sirait - 12.10.2016 10:57

How can I copy from another closed workbook using file dialog, to choose the close workbook?

Ответить
yuliana fahriza
yuliana fahriza - 04.10.2016 13:42

Dear Sir, how to copy multiple column of data from two close workbooks with a button in vba? thanks

Ответить
Filip Świtoń
Filip Świtoń - 20.09.2016 10:41

I've checked an about twenty codes , and this one from you is right!
Thank Genious Man!!! :)

Ответить
Vijay Kumar
Vijay Kumar - 05.07.2016 17:21

Thanks lot, really helping huge.......

Ответить
Mitesh Patel
Mitesh Patel - 02.07.2016 15:59

Dear Sir how to use this vba code for multiple workbooks.

Ответить