Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 .... |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
method 'range' of object '_global' failed
Range("PropCode1").Value
The above giving a range method failed error is a strong indication that that range does not exist on the active worksheet. Does that name appear in the the Define Name dialog when you press Ctrl-F3? -- Jim "Schades" wrote in message oups.com... 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 ... |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
method 'range' of object '_global' failed
Hi
I have found that quite a few problems can arise when ranges are not qualified. Try qualifying them with the names of the worksheets. Alok "Schades" wrote: 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 .... |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Method 'Range' of object '_global' failed | Excel Discussion (Misc queries) | |||
Method Range of object '_Global' failed | Excel Programming | |||
What does XLS VB Method 'Range of object' _Global failed mean? | Excel Programming | |||
Method 'Range' of object '_Global' failed | Excel Programming | |||
Method 'Range' of object '_Global' failed | Excel Programming |