Can someone help me!!!!!!!! Please!!!!!!!!! am a visual basic novice and am trying to building a calculator in excel using the “Worksheet_Change” code but unfortunately its not working properly. So, am seeking some advice…………
What I want:
• The code to perform is an automatic update once a cell has changes.
Lets say when H3=Renewals,
Hide some cells and go to H3 and don’t run the code again unless I type something other than Renewals
It should also let me continue working with the worksheet cells (That’s my main problem the code runs over and over and over again and it doesn’t let me continue)
The code that am using is:
Private Sub Worksheet_Change(ByVal Target As Range)
* First action I want the code to perform
If Range("H3") = "RENEWALS" Then
Range("b37").Select
Sheets("COVER PAGE").Select
Rows("37:43").Select
Selection.EntireRow.Hidden = True
Range("h3").Select
Else
Rows("37:43").Select
Selection.EntireRow.Hidden = False
Range("D7").Select
End If
* Code should stop here and let the user continue till the next if statement
If Range("M26") = "Yes" Then
Range("b76").Select
Sheets("COVER PAGE").Select
Rows("76:77").Select
Selection.EntireRow.Hidden = False
Range("D30").Select
Else
Rows("76:77").Select
Selection.EntireRow.Hidden = True
Range("D30").Select
End If
* Code should stop here and let the user continue till the next if statement
If Range("M24") = "REVISED" Then
Range("a55").Select
Sheets("COVER PAGE").Select
Rows("50:57").Select
Selection.EntireRow.Hidden = False
Rows("55:56").Select
Selection.EntireRow.Hidden = True
Rows("60:66").Select
Selection.EntireRow.Hidden = True
Range("d52").Select
End If
* Code should stop here and let the user continue till the next if statement
'PRINEW SUPER CALCULATIONS
If Range("M24") = "NEW" Then
Range("a52").Select
Sheets("COVER PAGE").Select
Rows("50:57").Select
Selection.EntireRow.Hidden = False
'Hide Row
Rows("53:54").Select
Selection.EntireRow.Hidden = True
'Hide
Rows("60:66").Select
Selection.EntireRow.Hidden = True
' SELECT CELLS AFTER HIDE....
Sheets("COVER PAGE").Select
Range("d52").Select
End If
* Code should stop here and let the user continue till the next if statement
'VICSUPER CALCULATIONS
If Range("M24") = "OTHER(Eg VICSUPER" Then
Range("A62").Select
Sheets("COVER PAGE").Select
Rows("51:66").Select
Selection.EntireRow.Hidden = False
' Hide
Sheets("COVER PAGE").Select
Rows("51:56").Select
Selection.EntireRow.Hidden = True
' SELECT CELLS AFTER HIDE....
Sheets("COVER PAGE").Select
'Range("E62").Select
End If
* Code should stop here and let the user continue till the next if statement
'SERB SUPER CALCULATIONS
If Range("M24") = "SERB" Then
Sheets("COVER PAGE").Select
Rows("50:57").Select
Selection.EntireRow.Hidden = False
'Hide
Rows("51:56").Select
Selection.EntireRow.Hidden = True
'Hide
Rows("60:66").Select
Selection.EntireRow.Hidden = True
' SELECT CELLS AFTER HIDE....
Sheets("COVER PAGE").Select
Range("c80").Select
End If
* Code should stop here and let the user continue till the next if statement
End Sub
Bookmarks