Macro for copying sheet1 from work book1 to sheet2 workbook2

ssahmed77

New Member
Joined
Nov 21, 2005
Messages
4
Hi to all
I would like a macro which can copy a sheet(sheet1) from workbook1 while workbook is closed, into sheet2 of workbook2, i need to copy the whole sheet, please help me in this regard I am very thankfull for all of you. :cool:
 
L

Legacy 51064

Guest
Have you tried to record a macro for this problem?

Create a button and put it on sheet2 of workbook2

Sub Copy()

'Open the data download file
Workbooks.Open "C:\Documents and Settings\yourname\Desktop\book1.xls"

'Update information from cells A:VI on the download sheet to the database
Windows("Book1.xls").Activate
Sheets("Sheet1").Select
Columns("A:VI").Select
Selection.Copy
Windows("Book2.xls").Activate
Sheets("Sheet2").Select
Columns("A:VI").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False

'Close the download sheet
Windows("Book1.xls").Activate
ActiveWindow.Close

End Sub
 

ssahmed77

New Member
Joined
Nov 21, 2005
Messages
4
Dear 98illini
Thanks for your reply I appreciate it sorry for replying you late
I try to use your code but I have a problem in it and the exact line where I debug it is
Columns("A:VI").Select
as your cide is stuck here its on the basis of debugging result
as I try several option here
Like Range("A2:d")
but it also not working
What do u think
 
L

Legacy 51064

Guest
Try:

Range("A2:D" & Cells(Rows.Count, "D").End(xlUp).Row)
 

Forum statistics

Threads
1,078,373
Messages
5,339,811
Members
399,328
Latest member
Jasonabelly

Some videos you may like

This Week's Hot Topics

Top