Results 1 to 4 of 4

Thread: Modelling and Formatting

  1. #1

    Modelling and Formatting

    Register for a FREE account, and/
    or Log in to avoid these ads!

    I am currently undertaking an exercise at varsity. I have 3 columns, with base, target, and actual. these 3 columns can be in percentages, actual numbers, dates, or currency. For example, base is 1-Jan-2013; target is 31-Dec-2013. The actual date is 20-Dec-2013.

    I would like the second and third columns to automatically change to the format of the first column, for example, if the first column is in percentage (%), the remaining two columns automatically change to percentage.

    is there a way of creating an error message on the second and third column if they do not match the format of the first column?

    Thank you in advance those who can assist.

  2. #2
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
        On Error GoTo ws_exit
        Application.EnableEvents = False
        If Not Intersect(Target, Me.Columns("A")) Is Nothing Then
            Target.Offset(0, 1).NumberFormat = Target.NumberFormat
            Target.Offset(0, 2).NumberFormat = Target.NumberFormat
        End If
        Application.EnableEvents = True
    End Sub

  3. #3
    I have used the following formula and it worked very well.

    =AND(CELL("format",A1)=CELL("format",B1),CELL("for mat",A1)=CELL("format",C1))

    My next question is as follows:
    I want to add another column with a dropdown of the different units of measurement, eg %, dates, numbers, etc.

    How can I use this formula to detect different formats in all the columns?

  4. #4
    How does that formula do what you originally asked for, set the cell's format? It just tells you if they are the same.

Posting Permissions

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