Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Moving information between worksheets

I have a worksheet set up with a series of information that will act as a
master worksheet. I would like this spreadsheet to automatically populate
itself with updated information as it occurs from other worksheets within the
same workbook i.e. it will look for a relevent code reference and change the
appropriate cell, entering the latest information. Is this possible and if
so how?

GDD
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Moving information between worksheets

You need a macro. This code will create a Master worksheet and can also be
run to update the data in the Master Worksheet.

Simply create a blank worksheet call Master. The code checks the Header Row
and Header Column on each worksheet and adds the data to the Master Sheet.

After running the code the 1st time you can re-arrange the order of the
columns and rows as you like. Then when the code is run again it will keep
the same order. You don't have to clear the master sheet between runs of the
macro. If new rows or columns are added to any sheet the code will
automatically add these rows to the last row/column in the master worksheet.

Sub UpdateMaster()

Set MasterSht = Sheets("Master")

With MasterSht
'get row and column where to place new rows and columns
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
NewRow = LastRow + 1
LastCol = .Cells(1, Columns.Count).End(xlToLeft).Column
NewCol = LastCol + 1
End With

For Each sht In Sheets
If sht.Name < MasterSht.Name Then
With sht
LastRow = .Range("A" & Rows.Count).End(xlUp).Row
LastCol = .Cells(1, Columns.Count).End(xlToLeft).Column

'loop through a worksheet skipping headers
For RowCount = 2 To LastRow
RowHeader = .Range("A" & RowCount)
For ColCount = 2 To LastCol
ColHeader = .Cells(1, ColCount)
Data = .Cells(RowCount, ColCount)

'now look up data in Master Sheet
With MasterSht
Set c = .Columns("A").Find(what:=RowHeader, _
LookIn:=xlValues, Lookat:=xlWhole)
If c Is Nothing Then
AddRow = NewRow
.Range("A" & AddRow) = RowHeader
NewRow = NewRow + 1
Else
AddRow = c.Row
End If

Set c = .Rows(1).Find(what:=ColHeader, _
LookIn:=xlValues, Lookat:=xlWhole)
If c Is Nothing Then
AddCol = NewCol
.Cells(1, AddCol) = ColHeader
NewCol = NewCol + 1
Else
AddCol = c.Column
End If

'put updated data into master worksheet
.Cells(AddRow, AddCol) = Data
End With
Next ColCount
Next RowCount
End With

End If
Next sht
End Sub


"Gary D" wrote:

I have a worksheet set up with a series of information that will act as a
master worksheet. I would like this spreadsheet to automatically populate
itself with updated information as it occurs from other worksheets within the
same workbook i.e. it will look for a relevent code reference and change the
appropriate cell, entering the latest information. Is this possible and if
so how?

GDD

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
moving information within a workbook kinsey Excel Discussion (Misc queries) 1 June 30th 09 03:19 PM
moving Imported information J Excel Discussion (Misc queries) 1 April 9th 08 07:35 PM
moving part of information from one cell to another... auntwanette Excel Worksheet Functions 1 November 15th 06 10:07 PM
Moving Information Anupkumar Excel Worksheet Functions 7 June 22nd 06 03:44 AM
Moving information to a different page Andy Excel Worksheet Functions 2 June 5th 06 08:19 PM


All times are GMT +1. The time now is 03:42 AM.

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

About Us

"It's about Microsoft Excel"