Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Error Help!


Dear all,

I have a code in Excel and whenever I run the program there is an
error:

Method 'Cells' of object '_Worksheet' failed

and error number is -2147417848

Could any one can help me or if I have the error number how can I get
help on line (which website I can access)

Thanks a lot!

Nam


--
lehainam
------------------------------------------------------------------------
lehainam's Profile: http://www.excelforum.com/member.php...o&userid=18615
View this thread: http://www.excelforum.com/showthread...hreadid=395524

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Excel Error Help!

you are using the Cells without the parent worksheet name. Use it as

Worksheets("Sheet1").Cells

Mangesh



"lehainam" wrote in
message ...

Dear all,

I have a code in Excel and whenever I run the program there is an
error:

Method 'Cells' of object '_Worksheet' failed

and error number is -2147417848

Could any one can help me or if I have the error number how can I get
help on line (which website I can access)

Thanks a lot!

Nam


--
lehainam
------------------------------------------------------------------------
lehainam's Profile:

http://www.excelforum.com/member.php...o&userid=18615
View this thread: http://www.excelforum.com/showthread...hreadid=395524



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Excel Error Help!

Hi Lehainam,

Please post your problematic code.


---
Regards,
Norman



"lehainam" wrote in
message ...

Dear all,

I have a code in Excel and whenever I run the program there is an
error:

Method 'Cells' of object '_Worksheet' failed

and error number is -2147417848

Could any one can help me or if I have the error number how can I get
help on line (which website I can access)

Thanks a lot!

Nam


--
lehainam
------------------------------------------------------------------------
lehainam's Profile:
http://www.excelforum.com/member.php...o&userid=18615
View this thread: http://www.excelforum.com/showthread...hreadid=395524



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Excel Error Help!

Hi Mangesh,

you are using the Cells without the parent worksheet name. Use it as

Worksheets("Sheet1").Cells


If Cells were used without explicit qualification, it would represent a
range object referring to all the cells on the active sheet. Therefore, lack
of qualification should not, per se, cause an error.

If the active sheet were not a worksheet, then I would anticipate a 1004
run-time error rather than the OP's reported error.


---
Regards,
Norman



"Mangesh Yadav" wrote in message
...
you are using the Cells without the parent worksheet name. Use it as

Worksheets("Sheet1").Cells

Mangesh



"lehainam" wrote
in
message ...

Dear all,

I have a code in Excel and whenever I run the program there is an
error:

Method 'Cells' of object '_Worksheet' failed

and error number is -2147417848

Could any one can help me or if I have the error number how can I get
help on line (which website I can access)

Thanks a lot!

Nam


--
lehainam
------------------------------------------------------------------------
lehainam's Profile:

http://www.excelforum.com/member.php...o&userid=18615
View this thread:
http://www.excelforum.com/showthread...hreadid=395524





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Excel Error Help!

If it is not what Mangesh suggests, post the code for us to see.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Mangesh Yadav" wrote in message
...
you are using the Cells without the parent worksheet name. Use it as

Worksheets("Sheet1").Cells

Mangesh



"lehainam" wrote

in
message ...

Dear all,

I have a code in Excel and whenever I run the program there is an
error:

Method 'Cells' of object '_Worksheet' failed

and error number is -2147417848

Could any one can help me or if I have the error number how can I get
help on line (which website I can access)

Thanks a lot!

Nam


--
lehainam
------------------------------------------------------------------------
lehainam's Profile:

http://www.excelforum.com/member.php...o&userid=18615
View this thread:

http://www.excelforum.com/showthread...hreadid=395524







  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Excel Error Help!

Hi Norman,

quite true indeed. I did a small test, and with a chart as the active sheet
and using the Cells() without the parent sheet, I get a run time error 1004,
method cells of object global failed.

Thanks.

Mangesh




"Norman Jones" wrote in message
...
Hi Mangesh,

you are using the Cells without the parent worksheet name. Use it as

Worksheets("Sheet1").Cells


If Cells were used without explicit qualification, it would represent a
range object referring to all the cells on the active sheet. Therefore,

lack
of qualification should not, per se, cause an error.

If the active sheet were not a worksheet, then I would anticipate a 1004
run-time error rather than the OP's reported error.


---
Regards,
Norman



"Mangesh Yadav" wrote in message
...
you are using the Cells without the parent worksheet name. Use it as

Worksheets("Sheet1").Cells

Mangesh



"lehainam" wrote
in
message ...

Dear all,

I have a code in Excel and whenever I run the program there is an
error:

Method 'Cells' of object '_Worksheet' failed

and error number is -2147417848

Could any one can help me or if I have the error number how can I get
help on line (which website I can access)

Thanks a lot!

Nam


--
lehainam


------------------------------------------------------------------------
lehainam's Profile:

http://www.excelforum.com/member.php...o&userid=18615
View this thread:
http://www.excelforum.com/showthread...hreadid=395524







  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Error Help!


Dear all,

Thanks for your help.

Please find the attached file for your reference.

In this Workbook, I am standing in 'JI' sheet I click 'Save Data' to
copy data from this worksheet to 'Data' worksheet. The error will
occur.

Your help is appreciated.

Thanks a lot!

Nam


--
lehainam
------------------------------------------------------------------------
lehainam's Profile: http://www.excelforum.com/member.php...o&userid=18615
View this thread: http://www.excelforum.com/showthread...hreadid=395524

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Excel Error Help!

Hi Lehainam,

Few in this newsgroup will open attachments.

Post your code and indicate where the error is occurring in the code.


---
Regards,
Norman



"lehainam" wrote in
message ...

Dear all,

Thanks for your help.

Please find the attached file for your reference.

In this Workbook, I am standing in 'JI' sheet I click 'Save Data' to
copy data from this worksheet to 'Data' worksheet. The error will
occur.

Your help is appreciated.

Thanks a lot!

Nam


--
lehainam
------------------------------------------------------------------------
lehainam's Profile:
http://www.excelforum.com/member.php...o&userid=18615
View this thread: http://www.excelforum.com/showthread...hreadid=395524



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel Error Help!


Dear all,

Below is the code with error: Method 'Cells' of object '_Worksheet'
failed

Sub SaveData()
On Error GoTo SaveData_Err
Dim strJType
Dim x As Integer, i As Integer, j As Integer, m As Integer
Dim n As Integer, r As Integer, c As Integer
Sheets("Data").Activate

m = Range("A65536").End(xlUp).Row
If m <= 3 Then m = 3
Sheets("JI").Activate
strJType = Cells(34, 2)
x = Range("C65536").End(xlUp).Row
For i = 34 To x
j = (i - 33) * 2 + 2 + (m - 3)

'Trans. Ref
Sheets("Data").Cells(j, 1) = Range("J9")
Sheets("Data").Cells(j + 1, 1) = Range("J9")

'Period
Sheets("Data").Cells(j, 2) = Range("E29")
Sheets("Data").Cells(j + 1, 2) = Range("E29")

'Tran Date
Sheets("Data").Cells(j, 3) = Range("E30")
Sheets("Data").Cells(j + 1, 3) = Range("E30")

'Dr/Cr
Sheets("Data").Cells(j, 8) = "D"
Sheets("Data").Cells(j + 1, 8) = "C"

'JT
Sheets("Data").Cells(j, 10) = strJType
Sheets("Data").Cells(j + 1, 10) = strJType

'AC Code
Sheets("Data").Cells(j, 4) = Cells(i, 3)
Sheets("Data").Cells(j + 1, 4) = Cells(i, 5)

'T0 Code
Sheets("Data").Cells(j, 11) = Cells(i, 4)
Sheets("Data").Cells(j + 1, 11) = Cells(i, 4)

'Description
Sheets("Data").Cells(j, 9) = Cells(i, 6)
Sheets("Data").Cells(j + 1, 9) = Cells(i, 6)

'T1
Sheets("Data").Cells(j, 12) = Cells(i, 7)
Sheets("Data").Cells(j + 1, 12) = Cells(i, 7)

'T3
Sheets("Data").Cells(j, 14) = Cells(i, 8)
Sheets("Data").Cells(j + 1, 14) = Cells(i, 8)

'T4
Sheets("Data").Cells(j, 15) = Cells(i, 9)
Sheets("Data").Cells(j + 1, 15) = Cells(i, 9)

'T5
Sheets("Data").Cells(j, 16) = Cells(i, 10)
Sheets("Data").Cells(j + 1, 16) = Cells(i, 10)

'Amt
Sheets("Data").Cells(j, 5) = Cells(i, 11)
Sheets("Data").Cells(j + 1, 5) = Cells(i, 11)
Next

'Save Description
For n = 17 To 24
r = m + 1 'row
c = (n - 16) + 24 'Begin with column Y
Sheets("Data").Cells(r, c) = Cells(n, 3)
Sheets("Data").Cells(r + 1, c) = Cells(n, 11)
Next
Sheets("Data").Activate
Cells(m + 1, 1).Select
'MsgBox x
Exit Sub
SaveData_Err:
MsgBox Err.Description
Exit Sub
End Sub

Thanks a lot for your help!

Nam


--
lehainam
------------------------------------------------------------------------
lehainam's Profile: http://www.excelforum.com/member.php...o&userid=18615
View this thread: http://www.excelforum.com/showthread...hreadid=395524

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Excel Error Help!

Hi Lehainam,

Your code ran without problem for me and I was unable to reproduce your
error.

I would suggest that you download Rob Bovey's Code Cleaner Addin and retry
your code after running the addin.

The Code Cleaner addin is freely downloadable at:

http://www.appspro.com/Utilities/Utilities.htm

The downloaded EXE file initiates an automatic installation process. Once
loaded, the Code Cleaner can be called from the Tools menu.

---
Regards,
Norman



"lehainam" wrote in
message ...

Dear all,

Below is the code with error: Method 'Cells' of object '_Worksheet'
failed

Sub SaveData()
On Error GoTo SaveData_Err
Dim strJType
Dim x As Integer, i As Integer, j As Integer, m As Integer
Dim n As Integer, r As Integer, c As Integer
Sheets("Data").Activate

m = Range("A65536").End(xlUp).Row
If m <= 3 Then m = 3
Sheets("JI").Activate
strJType = Cells(34, 2)
x = Range("C65536").End(xlUp).Row
For i = 34 To x
j = (i - 33) * 2 + 2 + (m - 3)

'Trans. Ref
Sheets("Data").Cells(j, 1) = Range("J9")
Sheets("Data").Cells(j + 1, 1) = Range("J9")

'Period
Sheets("Data").Cells(j, 2) = Range("E29")
Sheets("Data").Cells(j + 1, 2) = Range("E29")

'Tran Date
Sheets("Data").Cells(j, 3) = Range("E30")
Sheets("Data").Cells(j + 1, 3) = Range("E30")

'Dr/Cr
Sheets("Data").Cells(j, 8) = "D"
Sheets("Data").Cells(j + 1, 8) = "C"

'JT
Sheets("Data").Cells(j, 10) = strJType
Sheets("Data").Cells(j + 1, 10) = strJType

'AC Code
Sheets("Data").Cells(j, 4) = Cells(i, 3)
Sheets("Data").Cells(j + 1, 4) = Cells(i, 5)

'T0 Code
Sheets("Data").Cells(j, 11) = Cells(i, 4)
Sheets("Data").Cells(j + 1, 11) = Cells(i, 4)

'Description
Sheets("Data").Cells(j, 9) = Cells(i, 6)
Sheets("Data").Cells(j + 1, 9) = Cells(i, 6)

'T1
Sheets("Data").Cells(j, 12) = Cells(i, 7)
Sheets("Data").Cells(j + 1, 12) = Cells(i, 7)

'T3
Sheets("Data").Cells(j, 14) = Cells(i, 8)
Sheets("Data").Cells(j + 1, 14) = Cells(i, 8)

'T4
Sheets("Data").Cells(j, 15) = Cells(i, 9)
Sheets("Data").Cells(j + 1, 15) = Cells(i, 9)

'T5
Sheets("Data").Cells(j, 16) = Cells(i, 10)
Sheets("Data").Cells(j + 1, 16) = Cells(i, 10)

'Amt
Sheets("Data").Cells(j, 5) = Cells(i, 11)
Sheets("Data").Cells(j + 1, 5) = Cells(i, 11)
Next

'Save Description
For n = 17 To 24
r = m + 1 'row
c = (n - 16) + 24 'Begin with column Y
Sheets("Data").Cells(r, c) = Cells(n, 3)
Sheets("Data").Cells(r + 1, c) = Cells(n, 11)
Next
Sheets("Data").Activate
Cells(m + 1, 1).Select
'MsgBox x
Exit Sub
SaveData_Err:
MsgBox Err.Description
Exit Sub
End Sub

Thanks a lot for your help!

Nam


--
lehainam
------------------------------------------------------------------------
lehainam's Profile:
http://www.excelforum.com/member.php...o&userid=18615
View this thread: http://www.excelforum.com/showthread...hreadid=395524



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel 2007 - error saving file & error loading dll TinaF Excel Discussion (Misc queries) 0 July 1st 09 01:49 PM
Error: "Excel encountered an error and had to remove some formatti Carl Excel Discussion (Misc queries) 0 September 18th 06 06:39 PM
Counting instances of found text (Excel error? Or user error?) S Davis Excel Worksheet Functions 5 September 12th 06 04:52 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM


All times are GMT +1. The time now is 10:15 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"