![]() |
Macro to copy data from one workbook to another
Hi,
I need to create a macro that opens up a specific excel file. This file has data that is split into twelve different columns (one for each month). I need this macro to create a msgbox that allows the user to select the month and then copy all the data in that row to the other document. Anyone have any ideas on this one? Thanks in Advance! |
Macro to copy data from one workbook to another
You say each month is in a column, then the user selects a specific colum
(month) and copies a row -- What row? assuming you mean column: You can select a column with Dim sh as Worksheet, bk as Workbook Dim rng as Range set bk = Workbooks.Open("C:\MyFolder\Myfile.xls") on error resume next set rng = Application.InputBox("select a column with your mouse",type:=8) On error goto 0 if rng is nothing then bk.close Savechanges:=false exit sub end if rng.EntireColumn.Copy Destination:= _ sh.Columns(3) bk.close Savechanges:=False -- Regards, Tom Ogilvy -- Regards, Tom Ogilvy "supamari0" wrote: Hi, I need to create a macro that opens up a specific excel file. This file has data that is split into twelve different columns (one for each month). I need this macro to create a msgbox that allows the user to select the month and then copy all the data in that row to the other document. Anyone have any ideas on this one? Thanks in Advance! |
All times are GMT +1. The time now is 09:16 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com