Macro code problem

  • Thread starter Thread starter Nick
  • Start date Start date
N

Nick

hi everyone,

I have a problem where I have macro code where i want to
refer to a range name but excel won't recognise what i
want it to do unless i put the cell reference in there.
The code is listed below, cell I175 is range named "cash".

by simply subsituting "cash" for $I$175 does not work!

any ideas?

If Target.Address = ("$I$175") Then
If Range("cash").Value <> 1 Then
Range("debt_terms").Select
Selection.EntireRow.Hidden = False

Range("cash").Select

Else
If Range("cash").Value = 1 Then
Range("debt_terms").Select
Selection.EntireRow.Hidden = True

Range("cash").Select

End If
End If
End If

Thank you very much
Cheers
Nick
 
Maybe:
if target.address = range("cash").address then
or
if intersect(target, range("cash")) is nothing then exit sub
 
try
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$I$175" Then

If Range("cash") <> 1 Then _
Range("debt_terms").EntireRow.Hidden = False

If Range("cash").Value = 1 Then _
Range("debt_terms").EntireRow.Hidden = True

Range("cash").Select

End If
End Sub
===
OR
=====
Sub UseCash()
If Range("cash") <> 1 Then _
Range("debt_terms").EntireRow.Hidden = False

If Range("cash").Value = 1 Then _
Range("debt_terms").EntireRow.Hidden = True

Range("cash").Select
End Sub
=======
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top