Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi all Excel Gurus,
I need help. I have an excel workbook with a sheet called template and i want to create a button to copy a selection of data which is B9:B34 and i need it to paste the information to another excel workbook with a sheet called data which will be A:AA and add each row when pressed. When the data has been copied over i need it to close the data sheet. Can someone help me please? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() When you copy a range of cells you only have to specify in the destination l;ocation the 1st cell of the range like I did below. Private Sub CommandButton1_Click() FName = "c:\temp\abc.xls" bk = Workbooks.Open(Filename:=FName) With bk.Sheets("Data") Lastrow = .Range("A" & Rows.Count).End(xlUp).Row NewRow = Lastrow + 1 ThisWorkbook.Sheets("Template").Rnage("B9:B34").Co py _ Destination:=.Range("A" & NewRow) End With bk.Close savechanges:=False End Sub -- joel ------------------------------------------------------------------------ joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229 View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=157082 Microsoft Office Help |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel 2003 Macro | Excel Discussion (Misc queries) | |||
Excel 2003 Macro help | Excel Programming | |||
Excel 2003 Macro | Excel Worksheet Functions | |||
Macro in Excel 2003 | Excel Programming | |||
macro in excel 2003 | Excel Worksheet Functions |