Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Summary that links to other sheets

I have coding that pulls data from 70-80 worksheets into a summary sheet (the
number changes every month), and that's worked fine for quite a while, but
others are going to be using this workbook now, and I'd like for them to be
able to make changes on the worksheets and have it update the summary when
they do. The coding below pulls just the values in. Can anybody tell me what
I need to do to have it link to the cells instead of just copying them? Or do
I need to just start over? Thank you for your help.


Sub Summary()

Dim sh As Worksheet
Dim DestSh As Worksheet
Dim Last As Long
Dim CopyRng As Range

Application.ScreenUpdating = False
Application.EnableEvents = False

'Delete the sheet "Summary" if it exists
Application.DisplayAlerts = False
On Error Resume Next
ActiveWorkbook.Worksheets("Summary").Delete
On Error GoTo 0
Application.DisplayAlerts = True

'Add a worksheet with the name "Summary"
Set DestSh = ActiveWorkbook.Worksheets.Add
DestSh.Name = "Summary"

'loop through all worksheets and copy the data to the DestSh
For Each sh In ActiveWorkbook.Worksheets
If sh.Name < DestSh.Name Then

'Find the last row with data on the DestSh
Last = LastRow(DestSh)

'Fill in the range that you want to copy
Set CopyRng = sh.Range("O9:R44")

'Test if there enough rows in the DestSh to copy all the data
If Last + CopyRng.Rows.Count DestSh.Rows.Count Then
MsgBox "There are not enough rows in the Destination Sheet"
GoTo ExitTheSub
End If

'This copies all values/formats

With CopyRng
DestSh.Cells(Last + 1, "A").Resize(.Rows.Count, _
.Columns.Count).Value = .Value
End With

End If
Next

ExitTheSub:

Application.GoTo DestSh.Cells(1)

'AutoFit the column width in the DestSh sheet
DestSh.Columns.AutoFit

Application.EnableEvents = True
Application.ScreenUpdating = True

End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200912/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Summary that links to other sheets

See
http://www.rondebruin.nl/summary.htm

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Joe_Hunt via OfficeKB.com" <u45578@uwe wrote in message news:a0bba85848f54@uwe...
I have coding that pulls data from 70-80 worksheets into a summary sheet (the
number changes every month), and that's worked fine for quite a while, but
others are going to be using this workbook now, and I'd like for them to be
able to make changes on the worksheets and have it update the summary when
they do. The coding below pulls just the values in. Can anybody tell me what
I need to do to have it link to the cells instead of just copying them? Or do
I need to just start over? Thank you for your help.


Sub Summary()

Dim sh As Worksheet
Dim DestSh As Worksheet
Dim Last As Long
Dim CopyRng As Range

Application.ScreenUpdating = False
Application.EnableEvents = False

'Delete the sheet "Summary" if it exists
Application.DisplayAlerts = False
On Error Resume Next
ActiveWorkbook.Worksheets("Summary").Delete
On Error GoTo 0
Application.DisplayAlerts = True

'Add a worksheet with the name "Summary"
Set DestSh = ActiveWorkbook.Worksheets.Add
DestSh.Name = "Summary"

'loop through all worksheets and copy the data to the DestSh
For Each sh In ActiveWorkbook.Worksheets
If sh.Name < DestSh.Name Then

'Find the last row with data on the DestSh
Last = LastRow(DestSh)

'Fill in the range that you want to copy
Set CopyRng = sh.Range("O9:R44")

'Test if there enough rows in the DestSh to copy all the data
If Last + CopyRng.Rows.Count DestSh.Rows.Count Then
MsgBox "There are not enough rows in the Destination Sheet"
GoTo ExitTheSub
End If

'This copies all values/formats

With CopyRng
DestSh.Cells(Last + 1, "A").Resize(.Rows.Count, _
.Columns.Count).Value = .Value
End With

End If
Next

ExitTheSub:

Application.GoTo DestSh.Cells(1)

'AutoFit the column width in the DestSh sheet
DestSh.Columns.AutoFit

Application.EnableEvents = True
Application.ScreenUpdating = True

End Sub

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200912/1

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Summary that links to other sheets

That is perfect! I really do appreciate it.

Ron de Bruin wrote:
See
http://www.rondebruin.nl/summary.htm

I have coding that pulls data from 70-80 worksheets into a summary sheet (the
number changes every month), and that's worked fine for quite a while, but

[quoted text clipped - 62 lines]

End Sub


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200912/1

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
How to combine amount in manys sheets into 1 summary sheets Frank Situmorang[_3_] Excel Programming 2 August 24th 09 12:07 PM
Adding hyper links from summary page to tab? Nelson Excel Programming 7 June 14th 09 09:18 PM
Managing links to Summary from constantly changing worksheet names klysell Excel Programming 6 February 27th 07 12:57 AM
Summary All Worksheets With links al007 Excel Programming 7 February 16th 06 08:35 AM
Viewing Links In a summary? leighann Excel Discussion (Misc queries) 1 August 17th 05 08:10 PM


All times are GMT +1. The time now is 07:20 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"