+ Reply to Thread
Results 1 to 5 of 5

How to enter a value in a cell

  1. #1
    Sinus Log
    Guest

    How to enter a value in a cell

    I've tried this macro and it works:
    Sub temp()
    Range("Comm!f7").Value = 0
    End Sub

    But what I need is a function. This one doesn't work, I get
    #VALUE!:
    Function temp1()
    Range("Comm!f7").Value = 0
    End Function

    And this doesn't work either:
    Function temp1()
    temp
    End Function

    There could be another way, a better one, but much too
    difficult for me. What I am trying to do is to erase from
    memory all the values pertaining to Sheet1, as soon as any
    of its cells is modified by the user (the values are
    preserved in memory as public arrays). By searching Google,
    I found references to Worksheet_Change. Can someone help me
    with that too, please ?

    Thanks

  2. #2
    Tom Ogilvy
    Guest

    Re: How to enter a value in a cell

    You can't change the value of other cells using a User Defined Function
    (UDF) in the worksheet. You can not change the worksheet environment either
    (no formatting).

    You can only return a value to the cell containing the function. You can
    reference other cells to use them for calculations, but you can not alter
    them.

    --
    Regards,
    Tom Ogilvy


    "Sinus Log" <[email protected]> wrote in message
    news:OkhjBSi%[email protected]...
    > I've tried this macro and it works:
    > Sub temp()
    > Range("Comm!f7").Value = 0
    > End Sub
    >
    > But what I need is a function. This one doesn't work, I get
    > #VALUE!:
    > Function temp1()
    > Range("Comm!f7").Value = 0
    > End Function
    >
    > And this doesn't work either:
    > Function temp1()
    > temp
    > End Function
    >
    > There could be another way, a better one, but much too
    > difficult for me. What I am trying to do is to erase from
    > memory all the values pertaining to Sheet1, as soon as any
    > of its cells is modified by the user (the values are
    > preserved in memory as public arrays). By searching Google,
    > I found references to Worksheet_Change. Can someone help me
    > with that too, please ?
    >
    > Thanks




  3. #3
    Arvi Laanemets
    Guest

    Re: How to enter a value in a cell

    Hi

    Sheets("Comm").Range("F7").Value=0


    --
    Arvi Laanemets
    ( My real mail address: arvil<at>tarkon.ee )


    "Sinus Log" <[email protected]> wrote in message
    news:OkhjBSi%[email protected]...
    > I've tried this macro and it works:
    > Sub temp()
    > Range("Comm!f7").Value = 0
    > End Sub
    >
    > But what I need is a function. This one doesn't work, I get #VALUE!:
    > Function temp1()
    > Range("Comm!f7").Value = 0
    > End Function
    >
    > And this doesn't work either:
    > Function temp1()
    > temp
    > End Function
    >
    > There could be another way, a better one, but much too difficult for me.
    > What I am trying to do is to erase from memory all the values pertaining
    > to Sheet1, as soon as any of its cells is modified by the user (the values
    > are preserved in memory as public arrays). By searching Google, I found
    > references to Worksheet_Change. Can someone help me with that too, please
    > ?
    >
    > Thanks




  4. #4
    Arvi Laanemets
    Guest

    Re: How to enter a value in a cell

    Oops! I throughly missed this point - I concentrated on single row only :-(


    --
    Arvi Laanemets
    ( My real mail address: arvil<at>tarkon.ee )



    "Tom Ogilvy" <[email protected]> wrote in message
    news:%23k9ZOvi%[email protected]...
    > You can't change the value of other cells using a User Defined Function
    > (UDF) in the worksheet. You can not change the worksheet environment
    > either
    > (no formatting).
    >
    > You can only return a value to the cell containing the function. You can
    > reference other cells to use them for calculations, but you can not alter
    > them.
    >
    > --
    > Regards,
    > Tom Ogilvy
    >
    >
    > "Sinus Log" <[email protected]> wrote in message
    > news:OkhjBSi%[email protected]...
    >> I've tried this macro and it works:
    >> Sub temp()
    >> Range("Comm!f7").Value = 0
    >> End Sub
    >>
    >> But what I need is a function. This one doesn't work, I get
    >> #VALUE!:
    >> Function temp1()
    >> Range("Comm!f7").Value = 0
    >> End Function
    >>
    >> And this doesn't work either:
    >> Function temp1()
    >> temp
    >> End Function
    >>
    >> There could be another way, a better one, but much too
    >> difficult for me. What I am trying to do is to erase from
    >> memory all the values pertaining to Sheet1, as soon as any
    >> of its cells is modified by the user (the values are
    >> preserved in memory as public arrays). By searching Google,
    >> I found references to Worksheet_Change. Can someone help me
    >> with that too, please ?
    >>
    >> Thanks

    >
    >




  5. #5
    Sinus Log
    Guest

    Re: How to enter a value in a cell

    Arvi Laanemets wrote:
    > Hi
    >
    > Sheets("Comm").Range("F7").Value=0
    >
    >


    It doesn't work either, Arvi. Tom is certainly right. Thanks
    to both of you.
    I'll have to try to follow the other path. For that, I think
    it's better to open a new thread with the proper title:
    To detect changes in a worksheet

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1