Copy cell from one workbook and paste it in a different workbook

Hi all,

I have a excel macro that reads and format tables. I would like to be able to paste the format tables in anyone of the opened workbooks. I want the user of my macro to select where to past the format tables by clicking in an abritary cell in any of the opened workbooks.
I tried to do this with 'Inputbox', see code below but then I was locked to choose a cell within the workbook from where I ran the macro.

Any ideas out there

If bush = 1 Then
Set MyChoice = Application.InputBox(Prompt:="Select the starting cell " _
& "from where the data should be printed", Type:=8)
End If

Grateful for help on this

\Jonas




Answer this question

Copy cell from one workbook and paste it in a different workbook

  • Priyank Gajera

    Hey Jonas,

    This is a question of where do you place your code. If the code you have is in a workbook, but it applies changes to all workbooks, then it might be better creating an Excel addin. However I can't really recommend this as I don't have enough information about your project.

    There is a way for one workbook to use/store data in another workbook, you just have use the full path from the application object, an example would be better.

    This code was placed in workbook Book1

    Application.Workbooks("Book2").Sheets("Sheet1").Cells(1, 1).Value = 10

    You need to change the names used to reference the book and sheet. I have no idea if the input box provides this information, have a look.

    Hopefully this has helped.



  • Copy cell from one workbook and paste it in a different workbook