sujittalukde
10-03-2007, 12:11 AM
I am using a UDF created by a macro. the same is using at a sheet. the code for function is :
Function area(x As Double, y As Double) As Double
If y = 0 Then
area = x * x
Else
area = x * y
End If
End Function
In sheet1, at cell A3, a dropdown list is made via data validation containing "Rectangle" and "Square". I want that if the user selects the "rectangle", it should show the Row3 & Row 4. If the user selects the "Square" it should hide the row4. I have made the macro to do the same in a module and tried to do the same by ws selection chage methd but then it refreshes the entire sheet. Can some one please help me in this matter?
Sub GetArea()
If ActiveSheet.Range("A3").Value = "Square" Then
Rows("4:4").Select
Selection.EntireRow.Hidden = True
Range("B4").Select
Selection.ClearContents
Range("B3").Select
End If
If ActiveSheet.Range("A3").Value = "Rectangle" Then
Rows("3:5").Select
Range("A5").Activate
Selection.EntireRow.Hidden = False
Range("B4").Select
End If
End Sub
I want that if the user selects the "rectangle", it should show the Row3 & Row 4. If the user selects the "Square" it should hide the row4.This should happen on changing the cell A3 automatically.
Function area(x As Double, y As Double) As Double
If y = 0 Then
area = x * x
Else
area = x * y
End If
End Function
In sheet1, at cell A3, a dropdown list is made via data validation containing "Rectangle" and "Square". I want that if the user selects the "rectangle", it should show the Row3 & Row 4. If the user selects the "Square" it should hide the row4. I have made the macro to do the same in a module and tried to do the same by ws selection chage methd but then it refreshes the entire sheet. Can some one please help me in this matter?
Sub GetArea()
If ActiveSheet.Range("A3").Value = "Square" Then
Rows("4:4").Select
Selection.EntireRow.Hidden = True
Range("B4").Select
Selection.ClearContents
Range("B3").Select
End If
If ActiveSheet.Range("A3").Value = "Rectangle" Then
Rows("3:5").Select
Range("A5").Activate
Selection.EntireRow.Hidden = False
Range("B4").Select
End If
End Sub
I want that if the user selects the "rectangle", it should show the Row3 & Row 4. If the user selects the "Square" it should hide the row4.This should happen on changing the cell A3 automatically.