mmartens
Mechanical
- Jul 17, 2001
- 24
This is what I am doing I am importing data from a file to a work sheet which get the name of the file. I want to determine the max value in the colume from that work sheet and put it in the cell of an other work sheet which name stays the same.
Dim intlastrow As Integer
Dim FirstSheetName As String
' determine the total number of work sheet in the work book
LastWorkSheet = Worksheets.Count
'OPENS_A_DIALOGUE_BOX_TO_OPEN_THE_DATA_FILE()
Application.Dialogs(xlDialogOpen).Show ("*.out"
'Move the worksheet to the PipLin Report.xls file into the last worksheet place
FirstSheetName = Sheets(1).Name
Sheets(FirstSheetName).Select
Sheets(FirstSheetName).Move After:=Workbooks("Test Report Round.xls"
.Sheets(LastWorkSheet)
' Selecting the a column we finded the number of rows in it.
' The last row number is entered into varable name.
Range("A3"
.Select
Selection.End(xlDown).Select
intlastrow = ActiveCell.Row
' MOVE TO THE INFORMATION SHEET IN ORDER TO PUT IN INFORMATION
' This sheet name stays the same
Sheets("TEST INFORMATION SHEET"
.Select
Range("D22"
.Select ' this cell is in the work sheet "TEST INFORMATION SHEET"
ActiveCell.Formula = "=MAX(test!A3:A500)"
'This is the problem line
'(1) I do not know the name of the data sheet EXAMPLE HERE (test)
'(2) I do not know how long colume A is going to be
This is what I have tryed thinking that it would work but it did not
ActiveCell.Formula = " = MAX(INDIRECT(FirstSheetName)"!A3:A" & intlastrow)"
Any help would be great I am at the end of my rope...
Dim intlastrow As Integer
Dim FirstSheetName As String
' determine the total number of work sheet in the work book
LastWorkSheet = Worksheets.Count
'OPENS_A_DIALOGUE_BOX_TO_OPEN_THE_DATA_FILE()
Application.Dialogs(xlDialogOpen).Show ("*.out"
'Move the worksheet to the PipLin Report.xls file into the last worksheet place
FirstSheetName = Sheets(1).Name
Sheets(FirstSheetName).Select
Sheets(FirstSheetName).Move After:=Workbooks("Test Report Round.xls"
' Selecting the a column we finded the number of rows in it.
' The last row number is entered into varable name.
Range("A3"
Selection.End(xlDown).Select
intlastrow = ActiveCell.Row
' MOVE TO THE INFORMATION SHEET IN ORDER TO PUT IN INFORMATION
' This sheet name stays the same
Sheets("TEST INFORMATION SHEET"
Range("D22"
ActiveCell.Formula = "=MAX(test!A3:A500)"
'This is the problem line
'(1) I do not know the name of the data sheet EXAMPLE HERE (test)
'(2) I do not know how long colume A is going to be
This is what I have tryed thinking that it would work but it did not
ActiveCell.Formula = " = MAX(INDIRECT(FirstSheetName)"!A3:A" & intlastrow)"
Any help would be great I am at the end of my rope...