Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
vba editor does not like something about this????
Sub Macro1() Application.Workbooks("research.xls").Worksheets ("sheet1").Range("a1").ClearContents End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What makes you think that it "does not like" that? Do you get an
error? If so, what does the error say? Ray at work "Coyote" wrote in message ... vba editor does not like something about this???? Sub Macro1() Application.Workbooks("research.xls").Worksheets ("sheet1").Range("a1").ClearContents End Sub |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I get the standard error dialog box where I press the
debug button and the statement is highlighted in yellow. Is that what you mena?? -----Original Message----- What makes you think that it "does not like" that? Do you get an error? If so, what does the error say? Ray at work "Coyote" wrote in message ... vba editor does not like something about this???? Sub Macro1() Application.Workbooks("research.xls").Worksheets ("sheet1").Range("a1").ClearContents End Sub . |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What is the text in that dialog box before you click the debug
button? Ray at work "Coyote" wrote in message ... I get the standard error dialog box where I press the debug button and the statement is highlighted in yellow. Is that what you mena?? -----Original Message----- What makes you think that it "does not like" that? Do you get an error? If so, what does the error say? Ray at work "Coyote" wrote in message ... vba editor does not like something about this???? Sub Macro1() Application.Workbooks("research.xls").Worksheets ("sheet1").Range("a1").ClearContents End Sub . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
runtime error #9
subscript out of range -----Original Message----- What is the text in that dialog box before you click the debug button? Ray at work "Coyote" wrote in message ... I get the standard error dialog box where I press the debug button and the statement is highlighted in yellow. Is that what you mena?? -----Original Message----- What makes you think that it "does not like" that? Do you get an error? If so, what does the error say? Ray at work "Coyote" wrote in message ... vba editor does not like something about this???? Sub Macro1() Application.Workbooks("research.xls").Worksheets ("sheet1").Range("a1").ClearContents End Sub . . |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Alright, either you don't have a workbook named research.xls, or that
workbook doesn't have a sheet named sheet1. Try this: Sub kjasdf() Dim x On Error Resume Next Set x = Application.Workbooks("research.xls") MsgBox "After attempting to get the workbook, research.xls, the error is " & Err.Number & ": " & Err.Description Err.Clear Set x = x.Worksheets("sheet1") MsgBox "After attempting to get the worksheet, sheet1, the error is " & Err.Number & ": " & Err.Description Err.Clear End Sub Which of those msgboxes has an err.number that is not 0? Both or the second one? Ray at work "Coyote" wrote in message ... runtime error #9 subscript out of range -----Original Message----- What is the text in that dialog box before you click the debug button? Ray at work "Coyote" wrote in message ... I get the standard error dialog box where I press the debug button and the statement is highlighted in yellow. Is that what you mena?? -----Original Message----- What makes you think that it "does not like" that? Do you get an error? If so, what does the error say? Ray at work "Coyote" wrote in message ... vba editor does not like something about this???? Sub Macro1() Application.Workbooks("research.xls").Worksheets ("sheet1").Range("a1").ClearContents End Sub . . |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is that all on one line?
Do you have an open workbook Research.xls, which has a sheet names Sheet1? -- HTH RP (remove nothere from the email address if mailing direct) "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial wrote in message ... What makes you think that it "does not like" that? Do you get an error? If so, what does the error say? Ray at work "Coyote" wrote in message ... vba editor does not like something about this???? Sub Macro1() Application.Workbooks("research.xls").Worksheets ("sheet1").Range("a1").ClearContents End Sub |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
That is all there is in the macro:
Application.Workbooks("research.xls").Worksheets ("sheet1").Range("a1").ClearContents Yes the workbook research.xls is open The macro is in another workbook - macros.xls -----Original Message----- Is that all on one line? Do you have an open workbook Research.xls, which has a sheet names Sheet1? -- HTH RP (remove nothere from the email address if mailing direct) "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial wrote in message ... What makes you think that it "does not like" that? Do you get an error? If so, what does the error say? Ray at work "Coyote" wrote in message ... vba editor does not like something about this???? Sub Macro1() Application.Workbooks("research.xls").Worksheets ("sheet1").Range("a1").ClearContents End Sub . |
#9
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is the workbook open? If not, open it.
Perhaps you have misspelled the workbook name or the worksheet name or either does not exist? The two lines should be one line. Try a continuation character Application.Workbooks("research.xls").Worksheets _ ("sheet1").Range("a1").ClearContents Gord Dibben Excel MVP On Thu, 30 Dec 2004 12:12:34 -0800, "Coyote" wrote: vba editor does not like something about this???? Sub Macro1() Application.Workbooks("research.xls").Worksheet s ("sheet1").Range("a1").ClearContents End Sub |
#10
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
checked spelling and made sure both exist.
error says subscript out of range error #9 -----Original Message----- Is the workbook open? If not, open it. Perhaps you have misspelled the workbook name or the worksheet name or either does not exist? The two lines should be one line. Try a continuation character Application.Workbooks("research.xls").Worksheet s _ ("sheet1").Range("a1").ClearContents Gord Dibben Excel MVP On Thu, 30 Dec 2004 12:12:34 -0800, "Coyote" wrote: vba editor does not like something about this???? Sub Macro1() Application.Workbooks("research.xls").Workshee ts ("sheet1").Range("a1").ClearContents End Sub . |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
As Gordon said:
Sub Macro1() Application.Workbooks("research.xls") _ .Worksheets("sheet1") _ .Range("a1").ClearContents End Sub -- Regards, Tom Ogilvy "Coyote" wrote in message ... checked spelling and made sure both exist. error says subscript out of range error #9 -----Original Message----- Is the workbook open? If not, open it. Perhaps you have misspelled the workbook name or the worksheet name or either does not exist? The two lines should be one line. Try a continuation character Application.Workbooks("research.xls").Worksheet s _ ("sheet1").Range("a1").ClearContents Gord Dibben Excel MVP On Thu, 30 Dec 2004 12:12:34 -0800, "Coyote" wrote: vba editor does not like something about this???? Sub Macro1() Application.Workbooks("research.xls").Workshee ts ("sheet1").Range("a1").ClearContents End Sub . |
#12
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi, the code needs to be on all one line:
If you need/want a single line of code to be on two or more lines you must connect them with a space..then underscore...then hit return. -Like this: Application.Workbooks("research.xls").Worksheets _ ("sheet1").Range("a1").ClearContents -Hope this helps. Jim S "Coyote" wrote: vba editor does not like something about this???? Sub Macro1() Application.Workbooks("research.xls").Worksheets ("sheet1").Range("a1").ClearContents End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|