+ Reply to Thread
Results 1 to 10 of 10

copy formula from previos cell to next cell when i enter something

  1. #1
    Registered User
    Join Date
    09-09-2007
    Posts
    4

    Red face copy formula from previos cell to next cell when i enter something

    Hello
    I want to copy formula from previous row to next cell when i enter something in perticular cell.
    i.e


    --Colomn A --- Colomn B -- --------Colomn C
    1 01-09-07 ----- John ----------=vlookup(b2,$s$1:$t$10,2,false)
    2 01-09-07 ----- Smith -------- =vlookup(b3,$s$1:$t$10,2,false)
    3
    4
    5


    Now if i enter date in cell A3 then cell C3 should be automatically filled/copy formula as celll C2. and so on......
    then if i enter data to A4 then cell C4 should be automatically filled/copy formula from cell C3.

    how can i do this. any idea?

    I have also attached example file.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    Right click on the worksheet tab, view code and paste this. Your VLOOKUP references column B not A though. I haven't looked at your attachment.
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-23-2005
    Posts
    33

    Smile

    StephenR

    Awesome. excellet. Appreciate your support.

    Thank you.

    S.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You can open the Options Dialog from the Tools menu. In the Edit tab there is an option to extend formulas & formats. Once you have started entering data into a table the formulas will start to extend after 2 or 3 rows.

    Excel 2003 has improved Lists which automatically do this, see

    http://www.excel-it.com/excel2003_lists.htm
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    03-23-2005
    Posts
    33
    royUK
    thanks for reply
    But it does not work every time. If there is a blank row or colomn, then it would not work.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    If you are working with data like this in Excel, then your data should not have blank rows and columns.

  7. #7
    Registered User
    Join Date
    03-23-2005
    Posts
    33

    Question error

    StephenR

    when i am entering this line in VB it gives me error for "mmm-yy"


    Cells(Target.Row, 5).Formula = "=TEXT(A" & Target.Row & ","mmm-yy")"

    how can i resove this.

    pls help.

  8. #8
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606
    Does this work?
    Please Login or Register  to view this content.
    Because you have quotes in the formula you need to add extra ones, I think.

  9. #9
    Registered User
    Join Date
    03-23-2005
    Posts
    33
    no, its not working
    it does not give error when i type in VB as per your updated way
    but after closing VB when i enter value in excel,it goes to debug.

  10. #10
    Registered User
    Join Date
    03-23-2005
    Posts
    33
    sorry StephenR

    its working now.


    thanks again.

+ 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