+ Reply to Thread
Results 1 to 4 of 4

Thread: Default column value

  1. #1
    Valued Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    247

    Default column value

    Hi

    I have an excel 2010 file, to which I keep adding rows.
    I have a hidden column J which must have the same text "x" in every used row for my pivot to work.
    Since the column is hidden, I forget to update this column with "x" when I add a row, which screws up my pivot data.

    Is there a way for column J to be automatically updated with value "x" when I enter data in any of the columns A-I for a row?

    Thanks
    Ajay

  2. #2
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Riverside, CA
    MS-Off Ver
    Excel 2010
    Posts
    107

    Re: Default column value

    try:

    =IF(COUNTA(A2:I2)>0,"x","")
    Happy Excel'ing!

  3. #3
    Valued Forum Contributor
    Join Date
    03-11-2010
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    247

    Re: Default column value

    You mean copy paste this formula in column J of every row?
    That won't work for me because sometimes I insert rows between existing rows, and such rows will again miss "x" in col J.

    Any other suggestions?

    tia
    Ajay

  4. #4
    Forum Contributor
    Join Date
    01-28-2010
    Location
    Riverside, CA
    MS-Off Ver
    Excel 2010
    Posts
    107

    Re: Default column value

    Only thing I can think of is to make a macro for it, it should work regardless if the column is hidden or not. but J1 (or change the "J1" to "J2" in the macro code) needs to have the formula:

    =IF(COUNTA(A1:I1)>0,"x","")

    The macro will copy J1, paste down the column, then remove any excess empty cells at the bottom of column J. You will need to run it everytime you insert a new row, or after you insert all your new rows.

    I know you were looking for something more automatic, you may just need to make a note to remind you to do it. Best of luck.

    Marco code below:

    Sub x_into_Jcol()
    '
    ' x_into_Jcol Macro
    '
    
    '
        Range("J1").Select
        Selection.Copy
        Columns("J:J").Select
        ActiveSheet.Paste
        Selection.End(xlDown).Select
        ActiveCell.Offset(0, -1).Range("A1").Select
        Selection.End(xlUp).Select
        ActiveCell.Offset(1, 1).Range("A1").Select
        Range(Selection, Selection.End(xlDown)).Select
        Application.CutCopyMode = False
        Selection.ClearContents
    End Sub
    Happy Excel'ing!

+ 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.2.0