View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Schades Schades is offline
external usenet poster
 
Posts: 1
Default method 'range' of object '_global' failed

I get the error: Method 'Range' of object '_glogal' failed

I run the following call files code and it is giving me an error around
CStr(Range("PropCode1").Value).

Below is the table it references to pull the files. All files are
spelled correctly.

Counter1 1
TotCount1 106
PropCode1 AL


Sub CallFiles()

ChDir "C:\Documents and Settings\user"

Dim i As Integer
Dim strFileName As String
strFileName = CStr(Range("PropCode1").Value) & "-Budget06.xls"
Application.DisplayAlerts = False


' loop thru all the properties on the Props sheet
For i = 1 To CStr(Range("TotCount1").Value)
Range("Counter1") = i
Calculate
strFileName = CStr(Range("PropCode1").Value) & "-Budget06.xls"

FINAL_CORRECTIONS

Next i


End Sub

2nd MACRO [first few lines]:

Sub FINAL_CORRECTIONS()


Dim i As Integer
Dim strFileName As String
strFileName = CStr(Range("PropCode1").Value) & "-Budget06.xls"
Application.DisplayAlerts = False


ChDir "C:\Documents and Settings\user"
Workbooks.Open strFileName

FilePass = Sheets("DATASHEET").Range("E1")
Sheets("Corporate").Select
Range("H7").Select
ActiveSheet.Unprotect Password:=CStr(Range("FilePass"))
ActiveWorkbook.Unprotect Password:=CStr(Range("FilePass"))
Sheets("DATASHEET").Visible = True
ActiveWindow.LargeScroll ToRight:=-1
Sheets("DATASHEET").Select
Range("J7").Select
ActiveCell.FormulaR1C1 = "0%"
Range("J8").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("Calc Sheet").Visible = True
....