Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sum up identical workbooks


Hi

I have a 50 replies from a questionaire.. they have all filled in with
the number 1 for their choice. (all the workbooks is in the same
folder)

I'm trying to use an empty template of this questionaire, and have a
macro sum up all the responses of the other workbooks in this
template.

Answere range is "C9:G19".

I've tried for two days now and Im about to give up... can some of you
give me some advice please.

Thanks


--
Ctech


------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=514342

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Sum up identical workbooks

Hi,
See my reply (17th Feb) to your last posting ... does this help?

"Ctech" wrote:


Hi

I have a 50 replies from a questionaire.. they have all filled in with
the number 1 for their choice. (all the workbooks is in the same
folder)

I'm trying to use an empty template of this questionaire, and have a
macro sum up all the responses of the other workbooks in this
template.

Answere range is "C9:G19".

I've tried for two days now and Im about to give up... can some of you
give me some advice please.

Thanks


--
Ctech


------------------------------------------------------------------------
Ctech's Profile: http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=514342


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sum up identical workbooks


See my reply (17th Feb) to your last posting ... does this help?


Yeah it helped some, however not quite... anyway with some tweek I
managed to come up with a working macro... if of interest, I have
pasted in below....


The macro:


Dim sFileBase As String
Dim sFilename As String


Private Sub cmd_OK_Click()
'
'
' Macro recorded 09/01/2006 by Taylor Nelson Sofres plc
' Owner: Christian Simonsen - The Change Team
' Email:
'
'

Dim lCount As Long
Dim wbResults As Workbook
Dim wbCodeBook As Workbook
Dim wbSheet As Worksheet
Dim mRows As Long
Dim mSheet As String
Dim mCostCenter
Dim mRange


Dim tempValue
Dim newTempSheet As Worksheet

' Application.ScreenUpdating = False
' Application.DisplayAlerts = False
' Application.EnableEvents = False


Set wbCodeBook = ActiveWorkbook
Set wbSheet = ActiveSheet
' Set active Cell
Range("A4").Select

mAddress = GetFromWorkbook.Txt_Address.Text
mRange = GetFromWorkbook.RefEdit_Range.Text
mSheet = GetFromWorkbook.Txt_Sheet.Text
mCostCenter = GetFromWorkbook.RefEdit_mCostCenter.Text


With Application.FileSearch
..NewSearch
'Change path to suit
..LookIn = mAddress & "\"
..FileType = msoFileTypeExcelWorkbooks
'.Filename = "Book*.xls"




If .Execute 0 Then 'Workbooks in folder
For lCount = 1 To .FoundFiles.Count 'Loop through all.
'Open Workbook x and Set a Workbook variable to it
Set wbResults =
Workbooks.Open(Filename:=.FoundFiles(lCount), UpdateLinks:=0)

'--------------- CODE HERE ------------------
wbResults.Activate
Cells.Select
Selection.Copy


wbCodeBook.Activate
Sheets.Add
Set newTempSheet = ActiveSheet
newTempSheet.Paste
Application.CutCopyMode = False

For Each cell In Range(mRange)

wbSheet.Cells(cell.Row, cell.Column).Value =
wbSheet.Cells(cell.Row, cell.Column).Value +
newTempSheet.Cells(cell.Row, cell.Column)



Next cell

Application.DisplayAlerts = False
newTempSheet.Delete
Application.DisplayAlerts = True


'-------- END -- CODE HERE -- END ------------

' Do not save changes in opened workbooks
wbResults.Close SaveChanges:=False

Next lCount
End If
End With

On Error GoTo 0
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True

' Close the UserForm
Unload GetFromWorkbook
End Sub




Private Sub cmd_Cancel_Click()
Unload GetFromWorkbook
End Sub

Private Sub Frame1_Click()

End Sub


--
Ctech


------------------------------------------------------------------------
Ctech's Profile:
http://www.excelforum.com/member.php...o&userid=27745
View this thread: http://www.excelforum.com/showthread...hreadid=514342

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
Merging identical workbooks in Excel 2007 deegee Excel Discussion (Misc queries) 0 November 20th 08 01:55 PM
I have 2 identical workbooks within 1 file, how do I delete 1? rexie3 Excel Worksheet Functions 3 March 14th 07 02:53 PM
Replacing (identical) values in multiple workbooks simultaneously? BR4M Excel Programming 8 November 25th 04 04:35 PM
Inexplicable difference in row hiding speed - identical code, identical machines! Matt Larkin Excel Programming 5 November 1st 04 10:35 AM
Testing for Identical Cells George B[_2_] Excel Programming 1 April 10th 04 01:40 PM


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