ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Reading fields from multiple new files (https://www.excelbanter.com/excel-discussion-misc-queries/187065-reading-fields-multiple-new-files.html)

Marko

Reading fields from multiple new files
 
Hi

We create a number of new files from a template a day, and collect some data
from these new files for statistical purposes. What name / handle can I use
to have a
dynamic name for the workbook that is open in addistion to the stats workbook.

Heres what I got so far:

Sub openFile()

' OPEN FILE
openThisFile = Application.GetOpenFilename(FileFilter:="Excel Files (*.xls,
*xlsx), *.xls, *xlsx", Title:="Please select a file")
If openThisFile = False Then
' They pressed Cancel
MsgBox "Stopping because you did not select a file"
Exit Sub
Else
Workbooks.Open filename:=openThisFile
End If
' END OPEN FILE


Call selectNextRow
Call doRead

End Sub

**********

Sub selectNextRow()

'Activate the STATS sheet
Windows("Statistics.xls").Activate
Worksheets(4).Select

'Select the next available row
Application.ScreenUpdating = False
NextRow = Range("C65536").End(xlUp).Row + 1
Cells(NextRow, 1).Select
Application.ScreenUpdating = True

End Sub

************

Sub doRead()

ActiveCell.FormulaR1C1 = "='somethinghere'!R5C4"
Cells(Selection.Row, Columns.Count).End(xlToLeft).Offset(, 1).Select


End Sub

************

so i need a litlle something weher it says 'somethinghere' in doRead().
Can i get it from filename or openThisFile?

probably a newby question, but i am one so that's alright, right?

/marko




All times are GMT +1. The time now is 02:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com