![]() |
Showing a userform based on a condition.
I have a workbook that I want to show different Userforms
based on condition within the spreadsheet. When I only have the Private Sub set up everything works well, But when the 2nd one is added I get an error for anbigous name. Can anyone tell me how to correct this? Private Sub Worksheet_Change(ByVal Target As Range) If Range("P1BetDown") < Range("CBetDown") Then UserForm7.Show End If End Sub Private Sub Worksheet_Change(ByVal Target As Range) If Range("P1BetFlop") < Range("CBetFlop") Then UserForm8.Show End If End Sub Thanks Pete |
Showing a userform based on a condition.
Pete,
Combine the two procedures in to a single Change event procedure. E.g, Private Sub Worksheet_Change(ByVal Target As Range) If Range("P1BetDown") < Range("CBetDown") Then UserForm7.Show End If If Range("P1BetFlop") < Range("CBetFlop") Then UserForm8.Show End If End Sub -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Pete" wrote in message ... I have a workbook that I want to show different Userforms based on condition within the spreadsheet. When I only have the Private Sub set up everything works well, But when the 2nd one is added I get an error for anbigous name. Can anyone tell me how to correct this? Private Sub Worksheet_Change(ByVal Target As Range) If Range("P1BetDown") < Range("CBetDown") Then UserForm7.Show End If End Sub Private Sub Worksheet_Change(ByVal Target As Range) If Range("P1BetFlop") < Range("CBetFlop") Then UserForm8.Show End If End Sub Thanks Pete |
All times are GMT +1. The time now is 08:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com