Results 1 to 3 of 3

Retain Formula when Input is made

Threaded View

  1. #1
    Registered User
    Join Date
    03-22-2011
    Location
    London, England
    MS-Off Ver
    Excel 2007
    Posts
    63

    Retain Formula when Input is made

    Hi,

    I'm trying to make a two-in one cell, maybe that's a bad thing, but that document is edited by many people and they are messing formulas all the time

    I searched the forum and found one thread with this code:
    Private Sub Worksheet_Change(ByVal Target As Excel.Range)
    
    With Target
        If .Address(False, False) = "B1" Then
            If IsEmpty(.Value) Then
                Application.EnableEvents = False
                .Formula = "=IF(B1="""";"""";B1+1)"
                Application.EnableEvents = True
            End If
        End If
    End With
    
    End Sub
    but I can't seem to get it to work for me. Example what I am looking for: if you input 2012 in "B1" it should give it to you as "2012 y. actual". The same would go with C1, D1 and so forth. By the way, where should I input this code, in microsoft Excel Objects tab in "Sheet1 (Sheet 1)" or create a "module"?

    Thank you for your help.
    Last edited by drakaz; 04-11-2013 at 10:03 AM.

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