Link to home
Start Free TrialLog in
Avatar of Amour22015
Amour22015

asked on

Excel 2007 Conditional Linking

Thank you all for helping me!

I have this code:

If Not Intersect(Target, Range("C5:C600")) Is Nothing Then
         'Selected with Other option
        If Cells(Target.Row, 3) = "Other" Then
             'User types in and comes back with user input to cell
            Application.EnableEvents = False
            'Do While Cells(Target.Row, 6) = ""
                 'Get data from user
                If SaveValC <> "" Then
                    Cells(Target.Row, 3) = InputBox("Enter data for CLASS", "Mandatory data entry", SaveValC)
                Else
                    Cells(Target.Row, 3) = InputBox("Enter data for CLASS", "Mandatory data entry")
                End If
                 SaveValC = Cells(Target.Row, 3)
            'Loop
            Application.EnableEvents = True
        End If
        For Each change In Target.Cells
            If change.Text <> "Other" And Target.Text <> "" Then
            Application.EnableEvents = False
                message = InputBox("Enter Justification for Column " & Mid(change.Address, 2, 1), "Mandatory data entry")
                '-- insert data in target sheet
                Worksheets("JUSTIFICATION").Range(change.Address) = message
                '-- insert comment in current sheet
                Cells(change.Row, 3).Hyperlinks.Add Cells(change.Row, 3), "", "JUSTIFICATION!" & change.Address, , change.Text
                Application.EnableEvents = True
       
            End If
        Next change
    End If

I need:

If Cells(Row, 2) = Cells(Row,3) then no JUSTIFICATION 'If they match

Otherwise I need Mandatory JUSTIFICATION.

This code above does not work

Please Help!

Thank you!
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

You mention:
===
If Cells(Row, 2) = Cells(Row,3) then no JUSTIFICATION 'If they match
Otherwise I need Mandatory JUSTIFICATION.
This code above does not work
===
Don't know if you are aware but this code looks for any data that is input between cell C5 and C600 and then it ask for a justification input box and when anything is inout there it will look for a sheet called: JUSTIFICATION and copy whaterver was entered in the inputbox in the same column same row in the sheet JUSTIFICATION and turn the data that was originally input in sheet1 to hyperlink !!!

This is what this code is doing !!!

Now your post ask for something completly diffrent.
Can you pls post a sample workbook it would make our life easier to decript what you need.

rgds/gowflow
Avatar of Amour22015
Amour22015

ASKER

gowflow

When prompted for the justification I want that to be Mandatory.  I know that it looks for input between C5 and C600.  I also know that it writes to the JUSTIFICATION worksheet.  What I want is for it to be Mandatory?

Why would you need a sample workbook, the logic is all there.


Thank you!
ok fine what do you want the user to input in the inputbox ? any text ? or you have some special values ?
gowlfow
gowflow

Thank you!

I worked out about the Mandatory, so that part is ok now.

But I still have:

If Cells(Row, 2) = Cells(Row,3) then no JUSTIFICATION 'If they match
Otherwise I need Mandatory JUSTIFICATION


And this is the real problem:

There is a drop-down in:
Cells(Row, 3)

The request that was given to me is that they want this in the drop-down:

C = Cat
D = Dog
TBD = To Be Determined
C - D = Cat and Dog
Ref = Reference (Text should provide reference)

And so on to about 25 different items.

What is in Column B or Cells(Row, 2) could be:
C
Or:
D
Or:
Ref

and so on.

So you notice that they do not match? But they kind of Match?

So I have to do something like:
If Cells(Row, 3) = "Ref = Reference (Text should provide reference)" And Cells(Row, 2) = "Ref" Then
Exit Sub
Else
If Cells(Row, 3) = "C = Cat" And Cells(Row, 2) = "C" Then
Exit Sub
Else


And so on.

Is there a way to do this samething but with this code? Or am I on the right track?

Thank you very much for helping me!
gowflow


sorry I meant to say:

Is there a way to do this samething with less coding?

Thank you!
gowflow

Thank you!

I tried:
If Cells(Target.Row, 3) = "Ref = Reference (Text should provide reference)" And Cells(Target.Row, 2) = "Ref" Then
Exit Sub
End If
If Cells(Target.Row, 3) = "C = Cat" And Cells(Target.Row, 2) = "C" Then
Exit Sub
End If

And so on.

That did not work?

Please help!

Thank you!

ASKER CERTIFIED SOLUTION
Avatar of Jacques Geday
Jacques Geday
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
gowflow


Thank you,

I found the problem and fixed it.  And that was just matching the text the correct way.

But I have one posting that no one has answered yet:
Excel 2007 Linking Multiple Text

If you could help with this one.

Thank you!
Had to close this one I found the problem.

Thank you for helping
pls post the link in here and will be glad to help
gowflow