View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default I have no idea why this is giving me a error: Windows(dataFile).Ac

replace the line
Windows(dataFile).Activate
with
Workbook(datafile).Activate

"madlinux" wrote:

I am coverting a Excel 97 spreadsheet to work with a new computer with
Excel 2003 installed, I am having some problems with querying collected
statistics to the data report file, I am getting the following error.

I am getting a "Run-time error '13' Type mismatch


Sub addStatsToDataFile()
'adds the collected statistics (max and min right now) to the data
report file
Dim x As Integer
Dim localResult As Variant

Application.StatusBar = "Adding statistical data in " & dataFile
Windows(dataFile).Activate ' THIS IS WHAT IS HIGHLIGHTED
WHEN I COMPILE
Application.ScreenUpdating = False
Selection.Name = "home" 'the current cell should be the last cell
(serial number column)
Selection.Formula = "max:"
stepRight 1
For x = 1 To numberOfTests
localResult = scaleStr(maxValue(x))
Selection.Formula = localResult
stepRight 1
If x 1 And x Mod 10 = 1 Then 'vertical page break after 10
columns...
Selection.Formula = "max:"
stepRight 1
End If
Next x
Range("home").Select
stepDown 1
Selection.Formula = "min:"
stepRight 1
For x = 1 To numberOfTests
localResult = scaleStr(minValue(x))
Selection.Formula = localResult
stepRight 1
If x 1 And x Mod 10 = 1 Then 'vertical page break after 10
columns...
Selection.Formula = "min:"
stepRight 1
End If
Next x
Range("home").Select
End Sub


I am new to using VBA for Excel but I am a quick study, I need to pick
up where the last sys admin left off.