Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.basic.visual.misc > #1279

Re: Run-time error '1004': Application-defined or object-defined error

From "Auric__" <not.my.real@email.address>
Newsgroups comp.lang.basic.visual.misc
Subject Re: Run-time error '1004': Application-defined or object-defined error
Date 2012-07-10 18:26 +0000
Organization A noiseless patient Spider
Message-ID <XnsA08C7465B128auricauricauricauric@88.198.244.100> (permalink)
References (1 earlier) <jtfl1v$3eu$1@dont-email.me> <3f392bc0-ccdf-46a7-a9f6-b1bc53cac8ff@googlegroups.com> <jthiho$2u2$1@dont-email.me> <XnsA08C6664F269auricauricauricauric@88.198.244.100> <jtholc$873$1@dont-email.me>

Show all headers | View raw


GS wrote:

> Auric__ expressed precisely :
>> GS wrote:
>>
>>> For example...
>>>
>>>   &#39;MsgBox timeStamp.Address
>>>
>>> ..what is "&#39;" in the above line of code?
>>
>> HTML-ism, courtesy of Google Gropes. &#39; -> '
>>
>> Check the original post; it shows up correctly there.
>
> Thanks, Auric! Yeah, that's where I copied my example lines from. I
> just wasn't sure why the code changed since the OP.<g>
>
> Regardless, the object ref in the Offset function can't be 'off the
> worksheet', and so the error is raised since there is no column 3 cols
> to the left of ColC.
>
> I haven't tried this but I expect the same error would result if we
> were trying to set an object ref to a cell outside a grid. I do know it
> happens with fpSpread.ocx and so is why I'm making the comparison.

The problem I have with the code you posted is that it fires if any cell in 
the changed range is in column C. Try copying a selection containing more 
than 1 column to column B -- you'll get "Run-time error '1004': Application-
defined or object-defined error".

What I would do would be more like this:

  Private Sub Worksheet_Change(ByVal Target As Range)
    Dim cell As Range
    For Each cell In Target
      If cell.Column = 3 Then
        With Cells(cell.Row, 1)
          If .Value = "" Then
            MsgBox "Nothing in there"
            .Value = Now
          Else
            MsgBox .Value
          End If
        End With
      End If
    Next
  End Sub

Also, I agree with your pointing the OP to the Excel group.

-- 
No, I never read the documentation -- why do you ask?

Back to comp.lang.basic.visual.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Run-time error '1004': Application-defined or object-defined error slimeph@gmail.com - 2012-07-09 11:27 -0700
  Re: Run-time error '1004': Application-defined or object-defined error GS <gs@somewhere.net> - 2012-07-09 18:13 -0400
    Re: Run-time error '1004': Application-defined or object-defined error slimeph@gmail.com - 2012-07-10 05:36 -0700
      Re: Run-time error '1004': Application-defined or object-defined error GS <gs@somewhere.net> - 2012-07-10 11:42 -0400
        Re: Run-time error '1004': Application-defined or object-defined error "Auric__" <not.my.real@email.address> - 2012-07-10 17:03 +0000
          Re: Run-time error '1004': Application-defined or object-defined error GS <gs@somewhere.net> - 2012-07-10 13:27 -0400
            Re: Run-time error '1004': Application-defined or object-defined error "Auric__" <not.my.real@email.address> - 2012-07-10 18:26 +0000
              Re: Run-time error '1004': Application-defined or object-defined error GS <gs@somewhere.net> - 2012-07-10 16:28 -0400
                Re: Run-time error '1004': Application-defined or object-defined error "Auric__" <not.my.real@email.address> - 2012-07-10 23:10 +0000
                Re: Run-time error '1004': Application-defined or object-defined error GS <gs@somewhere.net> - 2012-07-10 21:21 -0400
              Re: Run-time error '1004': Application-defined or object-defined error slimeph@gmail.com - 2012-07-10 15:26 -0700
                Re: Run-time error '1004': Application-defined or object-defined error "Auric__" <not.my.real@email.address> - 2012-07-10 23:24 +0000

csiph-web