Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VB6 and Excel - 1004 error
Thanks Ron and Samura. That worked.
"Rob Bovey" wrote in message ... Change the line: Set myRng = myWs.Range(myWs.Cells(1, 2)) '<== Error 1004 to: Set myRng = myWs.Cells(1, 2) The first line of code is feeding a Range object to the Range property of a Worksheet. This is not allowed. -- Rob Bovey, MCSE, MCSD, Excel MVP Application Professionals http://www.appspro.com/ * Please post all replies to this newsgroup * * I delete all unsolicited e-mail responses * "news.easynews.com" wrote in message ... Why would the following code give the error: 1004: Method 'Range' of object '_Worksheet' failed Dim myExcel As Excel.Application Dim myWb As Excel.Workbook Dim myWs As Excel.Worksheet Dim myRng As Excel.Range Set myExcel = New Excel.Application Set myWb = myExcel.Workbooks.Open("d:\test.csv") Set myWs = myWb.Sheets(1) Set myRng = myWs.Range(myWs.Cells(1, 2)) '<== Error 1004 MsgBox myRng.Address If I change the line giving the error to Set myRng = myWs.Range("B1") then it's ok. Any suggestions? Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel 2003 Macro Error - Runtime error 1004 | Excel Discussion (Misc queries) | |||
Error 1004 in Excel 97... | Excel Programming | |||
Error 1004 in Excel 2000 | Excel Programming | |||
EXCEL VBA - Run-time Error 1004 | Excel Programming | |||
EXCEL VBA - Run-time Error 1004 | Excel Programming |