View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Merging Excel data from identical copies of a workbook

John,

The following code may be something like what you need....
'-------------------------------------------------------------
Sub TransferToMasterSheet()
Dim rngMaster As Excel.Range
Dim rngCell As Excel.Range
Dim shtOne As Excel.Worksheet

On Error Resume Next
'Get all the blank cells in the Master Workbook sheet.
'The Master workbook sheet must be the active sheet.
Set rngMaster = ActiveSheet.UsedRange.SpecialCells(xlCellTypeBlank s)

'Specify the workbook and worksheet that the data is taken from.
'The other workbook must be open.
'You must insert the actual names in the line below...
Set shtOne = Workbooks("WorkbookName").Worksheets("SheetName")
On Error GoTo 0

'Go thru each blank cell in the Master sheet and extract data
'from the corresponding cell in the sheet with data.
If Not rngMaster Is Nothing Then
For Each rngCell In rngMaster
rngCell.Value = shtOne.Range(rngCell.Address).Value
Next
End If

'Clean up
Set rngCell = Nothing
Set rngMaster = Nothing
Set shtOne = Nothing
End Sub
'-----------------------------------------------------------------

Regards,
Jim Cone
San Francisco, USA


"John Guzz" wrote in message
...
I have two identical workbooks which must be maintained seperately and merged
occasionaly into a third identical MASTER.xls copy. There is no calculation
involved.

What I need to do is to look at each cell in a range and transfer its data
to the MASTER copy - ONLY if there is nothing in that cell already. If data
exists already in that cell of the the MASTER, I want to do nothing and
progress to the next cell.

I will need to do the same thing with at least one other copy.

The data amounts to a 1 used as a tick mark indicating a procedure performed.
MASTER.xls will ultimately have summaries and charts - that part is easy.

I am an OLD COBOL programmer, but a total newbie when it comes to VBA.
Any assistance would be greatly appreciated.
--
Old time COBOL programmer, new VBA programmer.