LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default Runtime error 1004 write data to a cell

it runs fine for me AFTER I change the col Val to ColVal
--
Hope this helps.
If it does, please click the Yes button.
Thanks in advance for your feedback.
Gary Brown



"Andreas Weber" wrote:

Hello

Always i get an error 1004 on the function above and i can't find my
mistake. I want to read values from the cell an write the steeps in an other
cell. On acces to the cell i get always error 1004.

Option Explicit

Function CalcTest(col Val As Integer, colRes As Integer) As Double
On Error GoTo ErrorHandle

Dim res As Double
Dim sum As Double
Dim i As Long
Dim errNr As Integer

res = 1
sum = 0
For i = 5 To 15
res = Cells(i, colVal).Value 'Read Value
sum = sum + res
Cells(i, colRes).Value = sum 'Write Result, here comes the
error 1004
Next i
CalcTest = sum
Exit Function

ErrorHandle:
errNr = Err.Number
Resume Next

End Function


Thanks for all help, i am very confused about this problem. I need this code
for an other function.

Andreas

 
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
Runtime error 1004 write data to a cell B Lynn B Excel Programming 0 April 15th 10 08:45 PM
Runtime error '1004' Cannot change part of a merged cell [email protected] Excel Programming 0 July 11th 08 02:48 AM
Getting error 1004 trying to write formula in cell Trefor Excel Programming 6 November 23rd 05 11:10 PM
Runtime error 1004 - when I increase the amount of data Rachel Curran Excel Programming 1 October 14th 04 01:16 PM
Excel 2002 Data Forms runtime error 1004 Charles Osborne Excel Programming 6 May 2nd 04 03:46 AM


All times are GMT +1. The time now is 02:37 PM.

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

About Us

"It's about Microsoft Excel"