Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Run-time error : method failed

I have written a small macro (to convert an old spreadsheet to Euro)

Sub naar_euro()

Dim myCell As Range
Dim temp As Variant

Set myCell = ActiveCell
temp = myCell.FormulaR1C1
myCell.FormulaR1C1 = "=(" & temp & ")/40.3399"

End Sub

The content of the activecell is a number (1234). When I reach the
line 'temp = ...' I get an error :

Run-time error '-2147319784 (800028018)': Method 'FormulaR1C1' of
object 'Range' failed.


I also tried the method 'Formula', but I got the same result.

What am I doing wrong ?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Run-time error : method failed

I don't know why your code fails for you. It runs for me.

Does this work?:

temp = myCell.Value

--
Jim Rech
Excel MVP
"Joris Adriaenssens" wrote in message
om...
|I have written a small macro (to convert an old spreadsheet to Euro)
|
| Sub naar_euro()
|
| Dim myCell As Range
| Dim temp As Variant
|
| Set myCell = ActiveCell
| temp = myCell.FormulaR1C1
| myCell.FormulaR1C1 = "=(" & temp & ")/40.3399"
|
| End Sub
|
| The content of the activecell is a number (1234). When I reach the
| line 'temp = ...' I get an error :
|
| Run-time error '-2147319784 (800028018)': Method 'FormulaR1C1' of
| object 'Range' failed.
|
|
| I also tried the method 'Formula', but I got the same result.
|
| What am I doing wrong ?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Run-time error : method failed

no, it doesn't work.
When I try to debug and go through the different program-lines step by step,
then I can go with the mouse-cursor over the text 'activecell.value', and
then the value of the cell in the spreadsheet appears in a little box :
'activecell.value = 1050'. The same thing happens when I try
activecell.formula (but then the box shows the formula).

The macro is in the persnlk.xls file (dutch version). When I put the macro
in the workbook I am working on, everything works OK.
I stopped experimenting because I thought the code was wrong, so I only
found out now that I had to put the code in the worksheet it has to work on,
but I want the macro always available.


"Jim Rech" wrote in message
...
I don't know why your code fails for you. It runs for me.

Does this work?:

temp = myCell.Value

--
Jim Rech
Excel MVP
"Joris Adriaenssens" wrote in message
om...
|I have written a small macro (to convert an old spreadsheet to Euro)
|
| Sub naar_euro()
|
| Dim myCell As Range
| Dim temp As Variant
|
| Set myCell = ActiveCell
| temp = myCell.FormulaR1C1
| myCell.FormulaR1C1 = "=(" & temp & ")/40.3399"
|
| End Sub
|
| The content of the activecell is a number (1234). When I reach the
| line 'temp = ...' I get an error :
|
| Run-time error '-2147319784 (800028018)': Method 'FormulaR1C1' of
| object 'Range' failed.
|
|
| I also tried the method 'Formula', but I got the same result.
|
| What am I doing wrong ?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Run-time error : method failed

I have no idea why that line would not run in your personal workbook. It
should as far as I can tell. Sorry.

--
Jim Rech
Excel MVP

"Joris Adriaenssens" wrote in message
...
| no, it doesn't work.
| When I try to debug and go through the different program-lines step by
step,
| then I can go with the mouse-cursor over the text 'activecell.value', and
| then the value of the cell in the spreadsheet appears in a little box :
| 'activecell.value = 1050'. The same thing happens when I try
| activecell.formula (but then the box shows the formula).
|
| The macro is in the persnlk.xls file (dutch version). When I put the
macro
| in the workbook I am working on, everything works OK.
| I stopped experimenting because I thought the code was wrong, so I only
| found out now that I had to put the code in the worksheet it has to work
on,
| but I want the macro always available.
|
|
| "Jim Rech" wrote in message
| ...
| I don't know why your code fails for you. It runs for me.
|
| Does this work?:
|
| temp = myCell.Value
|
| --
| Jim Rech
| Excel MVP
| "Joris Adriaenssens" wrote in message
| om...
| |I have written a small macro (to convert an old spreadsheet to Euro)
| |
| | Sub naar_euro()
| |
| | Dim myCell As Range
| | Dim temp As Variant
| |
| | Set myCell = ActiveCell
| | temp = myCell.FormulaR1C1
| | myCell.FormulaR1C1 = "=(" & temp & ")/40.3399"
| |
| | End Sub
| |
| | The content of the activecell is a number (1234). When I reach the
| | line 'temp = ...' I get an error :
| |
| | Run-time error '-2147319784 (800028018)': Method 'FormulaR1C1' of
| | object 'Range' failed.
| |
| |
| | I also tried the method 'Formula', but I got the same result.
| |
| | What am I doing wrong ?
|
|
|
|


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Run-time error : method failed

Jim,

When I make a new workbook, and place the macro in it, it works. So I
placed the new workbook in the xlstart-directory.
I think the macro doesn't work, because the original personal.xls file
is made with a Dutch version of Excel, while I am working now with an
English version of Excel. The original macros in the workbook work
fine, but when I try to put a new macro in the 'Dutch' workbook, it
doesn't work. (I have seen this once before, but thought it was my
macro)

Thank you for the replies : they stimulated to continue searching.
Thank you

Joris Adriaenssens.


"Jim Rech" wrote in message ...
I have no idea why that line would not run in your personal workbook. It
should as far as I can tell. Sorry.

--
Jim Rech
Excel MVP

"Joris Adriaenssens" wrote in message
...
| no, it doesn't work.
| When I try to debug and go through the different program-lines step by
step,
| then I can go with the mouse-cursor over the text 'activecell.value', and
| then the value of the cell in the spreadsheet appears in a little box :
| 'activecell.value = 1050'. The same thing happens when I try
| activecell.formula (but then the box shows the formula).
|
| The macro is in the persnlk.xls file (dutch version). When I put the
macro
| in the workbook I am working on, everything works OK.
| I stopped experimenting because I thought the code was wrong, so I only
| found out now that I had to put the code in the worksheet it has to work
on,
| but I want the macro always available.
|
|
| "Jim Rech" wrote in message
| ...
| I don't know why your code fails for you. It runs for me.
|
| Does this work?:
|
| temp = myCell.Value
|
| --
| Jim Rech
| Excel MVP
| "Joris Adriaenssens" wrote in message
| om...
| |I have written a small macro (to convert an old spreadsheet to Euro)
| |
| | Sub naar_euro()
| |
| | Dim myCell As Range
| | Dim temp As Variant
| |
| | Set myCell = ActiveCell
| | temp = myCell.FormulaR1C1
| | myCell.FormulaR1C1 = "=(" & temp & ")/40.3399"
| |
| | End Sub
| |
| | The content of the activecell is a number (1234). When I reach the
| | line 'temp = ...' I get an error :
| |
| | Run-time error '-2147319784 (800028018)': Method 'FormulaR1C1' of
| | object 'Range' failed.
| |
| |
| | I also tried the method 'Formula', but I got the same result.
| |
| | What am I doing wrong ?
|
|
|
|

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
Run-time error '1004': AutoFill method of Range class failed murkaboris Excel Discussion (Misc queries) 10 April 16th 09 09:06 PM
Run-time error '1004': AutoFill method of Range class failed murkaboris Excel Discussion (Misc queries) 3 April 14th 09 10:35 PM
Run-Time error '1004' : Select method of Range class failed [email protected] Excel Discussion (Misc queries) 3 March 9th 07 01:36 PM
Run-time error "1004" Select method of range class failed Tallan Excel Discussion (Misc queries) 3 March 7th 07 05:22 PM
Run-time error '1004' PasteSpecial Method of Range Class Failed Kevin G[_2_] Excel Programming 1 February 3rd 04 05:01 AM


All times are GMT +1. The time now is 04:58 PM.

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"