how to paste data without opening file any vb code

chetanmehra1989

Board Regular
Joined
Jul 13, 2012
Messages
121
hello frd
can u tell me one think how to copy the data without opening file
for Ex..

i have large data in sheet1

amit-report
name id create-date
chetan1 1 1-june-12
chetan2 1 1-june-12
chetan3 1 1-june-12
chetan4 1 1-june-12

raj-report
name id create-date
anil1 1 1-june-12
anil2 1 1-june-12
anil3 1 1-june-12
anil4 1 1-june-12


i want this type of data copy+paste in next sheet(sheet2)
name id create-date
chetan1 1 1-june-12
chetan2 1 1-june-12
chetan3 1 1-june-12
chetan4 1 1-june-12
anil1 1 1-june-12
anil2 1 1-june-12
anil3 1 1-june-12
anil4 1 1-june-12



can any body help me to sort this matter

thanks & Regards
Chetan.mehra7
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Sub a()
Set sh1 = Sheets(1)
Set sh2 = Sheets(2)
With sh2
.Cells(1, 1).Value = "name"
.Cells(1, 2).Value = "id"
.Cells(1, 3).Value = "create-date"
End With
With sh1
lastrow = .Range("A" & Rows.Count).End(xlUp).Row
row2 = 2
For j = 1 To lastrow
If .Cells(j, 2) <> "" And .Cells(j, 2) <> "id" Then
.Rows(j).Copy sh2.Rows(row2)
row2 = row2 + 1
End If
Next
End With
End Sub
 
Upvote 0
thank patel 45 its working but i want this type of data in next sheet(sheet2)
name id create-date
chetan1 1 1-june-12
chetan2 1 1-june-12
chetan3 1 1-june-12
chetan4 1 1-june-12
anil1 1 1-june-12
anil2 1 1-june-12
anil3 1 1-june-12
anil4 1 1-june-12
 
Upvote 0
your code is giving this types of result



name id create-date
name id create-date
chetan1 1 1-june-12
chetan2 1 1-june-12
chetan3 1 1-june-12
chetan4 1 1-june-12
name id create-date
anil1 1 1-june-12

anil2 1 1-june-12
anil3 1 1-june-12
anil4 1 1-june-12


but i want this type of result


name id create-date
 
Upvote 0
name id create-date
chetan1 1 1-june-12
chetan2 1 1-june-12
chetan3 1 1-june-12
chetan4 1 1-june-12
anil1 1 1-june-12
anil2 1 1-june-12
anil3 1 1-june-12
anil4 1 1-june-12
 
Upvote 0

Forum statistics

Threads
1,223,275
Messages
6,171,127
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top