View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
DSC[_13_] DSC[_13_] is offline
external usenet poster
 
Posts: 1
Default help please! need a macro which can combine data from 2 excel sheets

Hi

You Could use this


Code
-------------------

Sub CopySheets()
Dim Wks As Worksheet
Dim rng As Range
Dim NumberofSheets As Integer
Dim I As Integer

'Set variables
Set Wks = ActiveSheet
Set rng = Wks.Range("A" & Range("A" & Rows.Count).End(xlUp).Row + 1)
NumberofSheets = Worksheets.Count

'copy the data accross and change the initial paste cell
For I = 2 To NumberofSheets
Worksheets(I).UsedRange.Copy Destination:=rng
Set rng = Wks.Range("A" & Range("A" & Rows.Count).End(xlUp).Row + 1)
Next I

End Sub

-------------------


with the sheet you are copying to as the first sheet of the curren
workbook.

HTH

Davi

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