• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Copy paste data

Abhijeet

Active Member
Hi
I want Copy paste from given path data into sheet1 then run this macro
 

Attachments

  • RandCols03-1.xls
    63 KB · Views: 9
I want given path then file name & sheet name that data copy paste in to file then run 2nd macro of that file
 
Can u give me macro hear because their is no option to upload the file.If u are not understand question then please tell me
 
If any one solution given on any portal & i m post same query then i can understand that is problem but no one give solution then what is problem tell me any one?
 
Please read this article to understand, how cross posting affects
http://www.excelguru.ca/content.php?184

I can help you but I still haven't got a clue as to what exactly are you after. Can you explain the requirement in detail?

e.g. When I click on the macro following should happen:
1. It should ask me to select one Excel file.
2. Then it should be opened and ask user to select a sheet....

PS: I see that you've made two posts in 2 minutes time. You can edit your first post in such case rather than creating one more post.
 
When I click on the macro following should happen:
1. It should ask me to select one Excel file.
2. Then it should be opened and ask user to select a sheet....
Then copy paste the data in this file & then run this Macro which i upload the file
 
Then copy paste the data in this file
Copy data from [location?] and paste to[location?]. Normal Excel workbook contains more than one sheet so please be specific.

Then copy paste the data in this file
4. And which one would be "this" file?
a. from which you will be running macro
b. or the one which is opened by the macro

Then run this macro
We are already running one macro. So where do you intend to keep this macro?
a. In the workbook, from which you will be running macro
b. or the one which is opened by the macro

We can help you only if you are willing to help yourself.
 
I upload this file hear RandCols03-1 this file contain macro i want in sheet 1 data copy paste from specific file now then run this macro
 
1. I don't think I have understood your requirement clearly.
2. I am not going to upload workbook.

A] First create a backup copy of the RandCols03-1.xls workbook.

B] Paste the following macro in the module1 where you have "copydata".
Code:
Sub GetDatafromAnotherFile()
Dim strFileName As String
Dim wbOpened As Workbook, wbThis As Workbook
Dim rng As Range

Set wbThis = ThisWorkbook
strFileName = Application.GetOpenFilename("Excel Files (*.xls*), *.xls*")

If strFileName = "False" Then
    MsgBox "No file selected!", vbExclamation
    Exit Sub
Else
    Set wbOpened = Workbooks.Open(strFileName)
    Set rng = Application.InputBox("Please select the range to copy!", "SELECT RANGE", Type:=8)
    If rng Is Nothing Then
        MsgBox "No range selected!", vbExclamation
        Exit Sub
    Else
        rng.Copy wbThis.Sheets(1).Range("A1")
    End If
End If

Call CopyData

End Sub

C] Now run the code "GetDatafromAnotherFile".

And if it doesn't work then wait for someone else to work it out for you. This is the best I think I can do in the current scenario.
 
Back
Top