Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default get information from other worksbooks

Hi there,

Not too good at vba so I'm not sure this is really possible...

I've put together an excel questionnaire which will be sent out to a
*lot* of people... the results of which will be presented on a
worksheet on each of the questionaires that are sent out (with true /
false values from each of the questions).

I want a way to collect all the results into one worksbook, without
having to copy / paste or add them up by hand. Is there any way to
write this into a macro? For example it might run something like

1. Open up the first questionnaire workbook,
2. extract the data and put it into the results worksbook
3. close the first results workbook
4. open up the second questionnaire workbook
5. etc...

until it's extracted all the results from the questionnaire returns.

The questionnaire returns may all have unpredicatable file names also..

Many thanks in advance

Chris

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default get information from other worksbooks

If you put all the workbooks in a single folder and no other workbooks in
that folder


Sub GetData()
Dim bk as workbook, rng as Range
Dim rng1 as Range, sPath as String
Dim icol as Long, sName as String
sPath = "C:\Mysurvey\"
sname = dir(spath & "*.xls")
icol = 1
do while sName < ""
set bk = workbooks.open(sPath & sName)
set rng = bk.worksheets("sheet1").Range("A2,A5,A7,A20,A25,A3 5,A31")
set rng1 = thisworkbook.Worksheets(1).cells(1,icol)
rng.copy rng1.offset(1,0)
icol = icol + 1
bk.close Savechanges:=False
Loop
End Sub

--
Regards,
Tom Ogilvy

" wrote:

Hi there,

Not too good at vba so I'm not sure this is really possible...

I've put together an excel questionnaire which will be sent out to a
*lot* of people... the results of which will be presented on a
worksheet on each of the questionaires that are sent out (with true /
false values from each of the questions).

I want a way to collect all the results into one worksbook, without
having to copy / paste or add them up by hand. Is there any way to
write this into a macro? For example it might run something like

1. Open up the first questionnaire workbook,
2. extract the data and put it into the results worksbook
3. close the first results workbook
4. open up the second questionnaire workbook
5. etc...

until it's extracted all the results from the questionnaire returns.

The questionnaire returns may all have unpredicatable file names also..

Many thanks in advance

Chris


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default get information from other worksbooks

Left out one line:

Sub GetData()
Dim bk as workbook, rng as Range
Dim rng1 as Range, sPath as String
Dim icol as Long, sName as String
sPath = "C:\Mysurvey\"
sname = dir(spath & "*.xls")
icol = 1
do while sName < ""
set bk = workbooks.open(sPath & sName)
set rng = bk.worksheets("sheet1").Range("A2,A5,A7,A20,A25,A3 5,A31")
set rng1 = thisworkbook.Worksheets(1).cells(1,icol)
rng.copy rng1.offset(1,0)
icol = icol + 1
bk.close Savechanges:=False
' add a line to get the next file
sName = Dir()
Loop
End Sub

--
Regards,
Tom Ogilvy




"Tom Ogilvy" wrote:

If you put all the workbooks in a single folder and no other workbooks in
that folder


Sub GetData()
Dim bk as workbook, rng as Range
Dim rng1 as Range, sPath as String
Dim icol as Long, sName as String
sPath = "C:\Mysurvey\"
sname = dir(spath & "*.xls")
icol = 1
do while sName < ""
set bk = workbooks.open(sPath & sName)
set rng = bk.worksheets("sheet1").Range("A2,A5,A7,A20,A25,A3 5,A31")
set rng1 = thisworkbook.Worksheets(1).cells(1,icol)
rng.copy rng1.offset(1,0)
icol = icol + 1
bk.close Savechanges:=False
Loop
End Sub

--
Regards,
Tom Ogilvy

" wrote:

Hi there,

Not too good at vba so I'm not sure this is really possible...

I've put together an excel questionnaire which will be sent out to a
*lot* of people... the results of which will be presented on a
worksheet on each of the questionaires that are sent out (with true /
false values from each of the questions).

I want a way to collect all the results into one worksbook, without
having to copy / paste or add them up by hand. Is there any way to
write this into a macro? For example it might run something like

1. Open up the first questionnaire workbook,
2. extract the data and put it into the results worksbook
3. close the first results workbook
4. open up the second questionnaire workbook
5. etc...

until it's extracted all the results from the questionnaire returns.

The questionnaire returns may all have unpredicatable file names also..

Many thanks in advance

Chris


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default get information from other worksbooks

you're a star - thanks Tom, I'll give this a go

Cheers,

Chris

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
Pivot table cutting information of a part of the information ASR Excel Discussion (Misc queries) 1 November 5th 09 02:09 PM
Help!! using sheet 1 information to change information on sheet 2 I want to learn more Excel Worksheet Functions 2 September 30th 08 05:25 PM
Accessing same cell in multiple worksbooks Gopi Excel Programming 1 November 23rd 05 03:24 PM
Open method of worksbooks class failed Ben Excel Programming 5 August 22nd 05 11:16 PM
Information from one cell pulls information from another cell ACTLibrarian Excel Programming 1 November 13th 04 04:01 PM


All times are GMT +1. The time now is 12:07 PM.

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"