Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Run Time Error 1004

Can anyone tell my what's wrong with the following:

lRaekke = ActiveCell.Row
dVSLoen = Cells(lRaekke, 9).Value
Debug.Print lRaekke, dVSLoen
sTimeAdresse = Cells(lRaekke, 7).Address
sEgenLoenAdresse = "Tilbudsoplysninger!" + Worksheets
("TilbudsOplysninger").Range("EgenLoen").Addres s
'=+Hvis(EgenLoen0;+Timer*EgenLoen;V&S løn)
sFormel = "=+Hvis(EgenLoen0;" + "+" + sTimeAdresse + "*"
+ "EgenLoen;" + "+" + CStr(dVSLoen) + ")"
Debug.Print sFormel '=+Hvis(EgenLoen0;+$G$34*EgenLoen;+0)

ActiveSheet.Cells(lRaekke, 9).Formula = sFormel

It keeps failing at the last line: RT error 1004:
Programdifined or Objectdifined Error

Thanks
Lars Kofod
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Run Time Error 1004

I don't speak this language, but when I have trouble fixing a formula that is
being populated by VBA, I do this:

sFormel = "'=....."

Then when I put it into the cell, it's just text. I go back to the worksheet
and remove that leading quote and see what excel yells about.

Also, I think I'd use & (ampersand) instead of + (Plus) to concatenate strings
when you're building the formula.

Lars Kofod wrote:

Can anyone tell my what's wrong with the following:

lRaekke = ActiveCell.Row
dVSLoen = Cells(lRaekke, 9).Value
Debug.Print lRaekke, dVSLoen
sTimeAdresse = Cells(lRaekke, 7).Address
sEgenLoenAdresse = "Tilbudsoplysninger!" + Worksheets
("TilbudsOplysninger").Range("EgenLoen").Addres s
'=+Hvis(EgenLoen0;+Timer*EgenLoen;V&S løn)
sFormel = "=+Hvis(EgenLoen0;" + "+" + sTimeAdresse + "*"
+ "EgenLoen;" + "+" + CStr(dVSLoen) + ")"
Debug.Print sFormel '=+Hvis(EgenLoen0;+$G$34*EgenLoen;+0)

ActiveSheet.Cells(lRaekke, 9).Formula = sFormel

It keeps failing at the last line: RT error 1004:
Programdifined or Objectdifined Error

Thanks
Lars Kofod


--

Dave Peterson

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' Bishop Excel Worksheet Functions 2 May 21st 09 04:28 PM
Run-time error '1004': Type of Sheet displayed Excel Discussion (Misc queries) 1 September 11th 06 05:13 PM
Run Time error 1004 Steph Excel Discussion (Misc queries) 1 May 4th 06 10:29 PM
Run time error 1004, General ODBC error [email protected] New Users to Excel 0 September 19th 05 01:41 AM
Run time error 1004 Eric[_14_] Excel Programming 0 December 3rd 03 12:41 AM


All times are GMT +1. The time now is 01:35 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"