View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Boris[_2_] Boris[_2_] is offline
external usenet poster
 
Posts: 11
Default How to copy automatically from sheetx to sheet1

On Sat, 01 Sep 2007 23:28:59 -0700, Macbet wrote:

Every day I have to write data to different worksheets.
So there is written as example in
sheet2 E80 value = 40.00
sheet3 E34 value = 25.50
sheet4 E78 value = 140.75

I would like to have this data automatically copied to
sheet1
Columns B2 = sheet2 E80
Columns B3 = sheet3 E34
Columns B4 = sheet4 E78

By the next daily entry the row will increase
And should copy
Columns B2 = sheet2 E81
Columns B3 = sheet3 E35
Columns B4 = sheet4 E79

Has somebody an idea, how to do this with excel?

Thanks in advance
macbet


Hi Macbet,

try this code:
---
Function GetLastCell(rRange As Variant) As Variant
GetLastCell = rRange.Cells(rRange.Rows.Count, 1).End(xlUp)
End Function
---

It will get you the last data of first column in given range, so if you use
it like this:

B2: =GetLastCell(Sheet2!E:E)
B3: =GetLastCell(Sheet3!E:E)
B4: =GetLastCell(Sheet4!E:E)

you will get your data.
You can substitute smaller range (I've used entire E columns) if you have
some another data below in those columns.

Regards,
B.