Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Relative cells in different sheets in same workbook

Until I can get it into Access, I need to use a workbook for work,
with 10 sheets in it.

To collect data I want to select a range (relative to the cursor) and
then select the same range from each sheet, copying each line to a
single sheet in the same, or a different w/book

On the next day, I would position the cursor down one line and repeat
the exercise to generate historical data on one sheet

Help!!

Lorence
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Relative cells in different sheets in same workbook

Try this one to copy the row from the activecell
Add a worksheet to your workbook first with the name "Collect"

Sub Test1()
Dim sh As Worksheet
Dim DestSh As Worksheet
Dim Last As Long
Dim r As Long
r = ActiveCell.Row
Application.ScreenUpdating = False
Set DestSh = Sheets("Collect")
For Each sh In ThisWorkbook.Worksheets
If sh.Name < DestSh.Name Then
Last = LastRow(DestSh) + 1
sh.Rows(r).Copy DestSh.Cells(Last, "A")
End If
Next
Application.ScreenUpdating = True
End Sub


Function LastRow(sh As Worksheet)
On Error Resume Next
LastRow = sh.Cells.Find(What:="*", _
After:=sh.Range("A1"), _
Lookat:=xlPart, _
LookIn:=xlFormulas, _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious, _
MatchCase:=False).Row
On Error GoTo 0
End Function

More information here
http://www.rondebruin.nl/copy2.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Lorence" wrote in message ...
Until I can get it into Access, I need to use a workbook for work,
with 10 sheets in it.

To collect data I want to select a range (relative to the cursor) and
then select the same range from each sheet, copying each line to a
single sheet in the same, or a different w/book

On the next day, I would position the cursor down one line and repeat
the exercise to generate historical data on one sheet

Help!!

Lorence



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
linking cells to other sheets within a workbook SPL Excel Discussion (Misc queries) 1 February 11th 09 07:07 PM
how to sum up the c13 cells in all of the sheets in a workbook Liz Excel Discussion (Misc queries) 1 January 26th 09 10:19 PM
Copying cells between sheets in a workbook Rick Excel Discussion (Misc queries) 2 November 21st 08 01:55 PM
add cells together from different sheets within a workbook s6292 Excel Worksheet Functions 4 July 15th 08 08:43 PM
Excel hyperlinks to other cells in workbook must be relative BarryB00 Excel Worksheet Functions 0 February 12th 06 01:40 AM


All times are GMT +1. The time now is 08:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"