+ Reply to Thread
Results 1 to 6 of 6

Write from a cell to another

Hybrid View

  1. #1
    Registered User
    Join Date
    06-25-2010
    Location
    Lisbon
    MS-Off Ver
    Excel 2007
    Posts
    92

    Lightbulb Write from a cell to another

    Hi ppl, how's everytthing ?

    i tryied to search this but with no success so i leave here the question:

    is it possible to excel to write a value in a cell from another cell ?

    example : if i put some value in cell A1 then , cell A2 will verify if (A1<>"";A3=A1;""), and if A1 diferent from "" it will fill A3 with A1 value.

    I know it seems confused since i could easy do in A3 if (A1="";"";A1) but the problem is that i have an sheet that exports to xml and in a cell contains any formula it assumes "" as an 0 and i do not want that.

    Was i too confused ? hope not.

    Thx in advanced
    Last edited by homasa; 06-25-2010 at 02:07 PM.

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Write from a cell to another

    Private Sub Worksheet_Change(ByVal Target As Range)
    Const WS_RANGE As String = "A1"     '<== change to suit
    
        On Error GoTo ws_exit
        Application.EnableEvents = False
    
        If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
            With Target
                .Offset(2, 0).Value2 = Value2
            End With
        End If
    
    ws_exit:
        Application.EnableEvents = True
    End Sub
    This is worksheet event code, which means that it needs to be
    placed in the appropriate worksheet code module, not a standard
    code module. To do this, right-click on the sheet tab, select
    the View Code option from the menu, and paste the code in.

  3. #3
    Registered User
    Join Date
    06-25-2010
    Location
    Lisbon
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Write from a cell to another

    Hello, Bob Phillips

    thx for your answer.
    1) Does that work automaticly? everytime i change a value in A1 it changes the other cell? do i have to call it ?
    2) cant it be more simple ? i have a tone of cells to do that . . . perhaps something like an array ?

    sorry i am an newbie . . .

    thx
    Last edited by homasa; 06-25-2010 at 07:47 AM.

  4. #4
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Write from a cell to another

    Quote Originally Posted by homasa View Post
    Hello, Bob Phillips

    thx for your answer.
    1) Does that work automaticly? everytime i change a value in A1 it changes the other cell? do i have to call it ?
    2) cant it be more simple ? i have a tone of cells to do that . . . perhaps something like an array ?

    sorry i am an newbie . . .

    thx
    Follow the instructions with the code, try it, and then tell us what it might need further.

  5. #5
    Registered User
    Join Date
    06-25-2010
    Location
    Lisbon
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Write from a cell to another

    Hello,

    sorry but i was in a worry and i solved it by erasing the fields (and their formulas) that had no value.
    It was simplier he!he!he!

    but thx anyway

  6. #6
    Registered User
    Join Date
    06-25-2010
    Location
    Lisbon
    MS-Off Ver
    Excel 2007
    Posts
    92

    Re: Write from a cell to another

    ok since no one answers the question,

    is there a way to make a macro (for example) to erase data cells in a specific range that contains no data ? i mean to erase the formulas atributed to them if the final value is "" ???

    thx in advanced

+ 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