Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pulling data from a spreadsheet that contains file names?

Status
Not open for further replies.

q4s72534

MIS
Aug 19, 2003
59
US
I'm trying to pull data from a spreadsheet containing my excel file names to open my excel files.

I kind of want to do a stored procedure. Any suggestions. thanks.
 
Hi,

What do you want to do? Open a bunch of Excel files?

Assuming that that sheet has only Excel filenames
Code:
for each c in activesheet.usedrange
  workbooks.open c.value
next
Hope this helps :)

Skip,
Skip@TheOfficeExperts.com
 
I want to do something like this??


wb2 = "b1:c2 (which is C:\name)"
Application.Workbooks.Open (wb2)

Windows("b1:c2 (which is C:\name)").Activate
Sheets("b1:c3 (which is sheet 1)").Select
Range("G23:CP23").Select
Selection.Copy



Windows("GL.xls").Activate
ActiveWorkbook.Save
ActiveWindow.Close
 
I want to do something like this??


wb2 = "b1:c2 (which is C:\name)"
Application.Workbooks.Open (wb2)

Windows("b1:c2 (which is C:\name)").Activate
Sheets("b1:c3 (which is sheet 1)").Select
Range("G23:CP23").Select
Selection.Copy



Windows("name.xls").Activate
ActiveWorkbook.Save
ActiveWindow.Close
 
I'm not understanding what
Code:
wb2 = "b1:c2  (which is C:\name)"
means.

"b1:c2 (which is C:\name)" is not a filename.

B1:C2 is 4 cells. What's in those 4 cells?


Skip,
Skip@TheOfficeExperts.com
 
so sorry for not explaining myself very well. I will work on that. i meant to put b1 instead of b1:c2. in that one cell, b1, is a path where my excel file is located. Instead of re-hardcoding i wanted my code to find the file path in one cell by pulling data from the excel table.

does that make more sense?

thanks!
 
So there's a filename in B1.

Where's the sheet name?
Are you gonna copy the same range on each sheet?
Where is the paste destination?

Where is the next filename/sheetname......??????

Help me out here!

Skip,
Skip@TheOfficeExperts.com
 
Sheet name : “sheet_name.xls”

This “sheet_name.xls” has the following page

Path sheet_name Range to copy
C:\sheet_name2.xls sheet 2A a1:a2
C:\sheet_name3.xls sheet 3b a1:c3
C:\sheet_name.xls sheet 5a



I want to be able to change data above and my code will
not have to be hard coded as it is.



wb2 = "C:\sheet_name2.xls"
Application.Workbooks.Open (wb2)

Windows("sheet_name2.xls").Activate
Sheets("sheet 2A ").Select
Range("a1:a2").Select
Selection.Copy

Windows("C:\sheet_name.xls").Activate
Sheets("sheet 5a").Select
ActiveWindow.LargeScroll ToRight:=-6
ActiveWindow.ScrollColumn = 1
Range("G23").Select
ActiveSheet.Paste

Windows("sheet_name2.xls ").Activate
ActiveWorkbook.Save
ActiveWindow.Close


Repeat…
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top