ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   join sheet 2 below sheet 1 (https://www.excelbanter.com/excel-programming/300866-join-sheet-2-below-sheet-1-a.html)

vikram

join sheet 2 below sheet 1
 
do we have a small visual basic command with the help of which we ca
copy the used range in sheet2 and paste it below used range in sheet1

i have that big macro but i want to have simpler way

anyone can help?
thanks a lot frnd

--
Message posted from http://www.ExcelForum.com


Mike Fogleman

join sheet 2 below sheet 1
 
Sub Append ()
Dim rwct
Sheet1.Activate
rwct = ActiveSheet.UsedRange.Rows.Count
Sheet2.Activate
ActiveSheet.UsedRange.Select
Selection.Copy Destination:=Sheet1.Range("A" & rwct + 1)
End Sub

Mike F
"vikram " wrote in message
...
do we have a small visual basic command with the help of which we can
copy the used range in sheet2 and paste it below used range in sheet1

i have that big macro but i want to have simpler way

anyone can help?
thanks a lot frnds


---
Message posted from http://www.ExcelForum.com/




vikram

join sheet 2 below sheet 1
 
not working frnd.

shows subscript out of rang

--
Message posted from http://www.ExcelForum.com


Mike Fogleman

join sheet 2 below sheet 1
 
On which line does the error occur?
"vikram " wrote in message
...
not working frnd.

shows subscript out of range


---
Message posted from http://www.ExcelForum.com/




Tom Ogilvy

join sheet 2 below sheet 1
 
Sub Tester2()
Dim rng As Range
Set rng = Worksheets("Sheet1").UsedRange
Worksheets("Sheet2").UsedRange.Copy _
rng.Rows(rng.Rows.Count + 1).Cells.Resize(1, 1)
End Sub

Assumes your sheets are named Sheet1 and Sheet2
--
Regards,
Tom Ogilvy


"vikram " wrote in message
...
not working frnd.

shows subscript out of range


---
Message posted from http://www.ExcelForum.com/




vikram

join sheet 2 below sheet 1
 
Dim vikram
Sheets("Sheet1").Activate
vikram = ActiveSheet.UsedRange.Rows.Count
Sheets("sheet2").Activate
ActiveSheet.UsedRange.Select
Selection.Copy Destination:=Sheet1.range("A" & vikram + 1)
End Sub

error occurs in "Selection.Copy Destination:=Sheet1.range("A" & vikra
+ 1)"

it says copy area and paste area are not same size

i have range from "a:z" in sheet 2 and the same range inn sheet

--
Message posted from http://www.ExcelForum.com


vikram

join sheet 2 below sheet 1
 
thanks a lot tom it is working

thanks to u also mike...u guys are grea

--
Message posted from http://www.ExcelForum.com


ross

join sheet 2 below sheet 1
 
Try this pal

Sheets("Sheet1").Select
Range("A1").Select
ActiveCell.SpecialCells(xlLastCell).Select
x = ActiveCell.Row
ActiveSheet.Cells(x + 1, 1).Select
x = ActiveCell.Address

Sheets("Sheet2").Select
Range("A1").Select
ActiveCell.SpecialCells(xlLastCell).Select
p = ActiveCell.Address

a = "a1"
Range(a, p).Select
Selection.Copy _
Destination:=Worksheets("sheet1").Range(x)

Good Luck
Ross


All times are GMT +1. The time now is 04:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com