Hello Experts
What's wrong with my code - copy table and paste the table and the next valuable row at another documents
ThanksCode:ub a_84() Worksheets("atr 1").Activate Range("g12").Activate Range("g" & 12 & ":i" & 250).Select Selection.Copy Workbooks("84.xls").Activate Worksheets("Sheet2").Activate Range("a1").Select Range("a1").End(xlDown).Offset(1, 0).Select ActiveSheet.Paste End Sub
Shark Man
Hi,
What isn't it doing that you expect? Also what do you mean by 'paste the table and the next valuable row at another documents'. That's not clear to me.
As an aside you don't need all those .Select and .Activate instructions. Just address the relevant sheet/range directly.
Regards
Richard Buttrey
If this was useful then please rate it appropriately.
Click the small star iconat the bottom left of my post.
Hello Richard
I want to copy table from one file to another file at the next available row
Thanks
Hi,
Do you really mean from one file (presumably workbook) to another? Your code is only using one workbook and copying within it.
Rgds
Richard Buttrey
If this was useful then please rate it appropriately.
Click the small star iconat the bottom left of my post.
Hay Richard
Probably that's my problem
I want to copy from the current file worksheet "atr 1" to another file name "84.xls worksheets "sheet 2"
Can you help repair my code ?
Thanks in advanced
Hi,
In which case try:
HTHCode:Sub a_84() Dim wbMain as Workbook, wbTemp as Workbook Set wbMain = ActiveWorkbook Workbooks.Open FileName:="a84.xls" 'note add a path string if a84 is not in the default folder Set wbTemp=Activeworkbook wbMain.Worksheets("atr 1").Range("g12").Copy Destination:= wbTemp.Worksheet("Sheet2").Range("A1").End(xlDown).Offset(1,0) 'then if necessary wbTemp.Save wbTemp.Close End Sub
Richard Buttrey
If this was useful then please rate it appropriately.
Click the small star iconat the bottom left of my post.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks