Displaying multiple forms

DaveRadford

Board Regular
Joined
Feb 18, 2010
Messages
63
Afternoon,

This is probably simple but i have tried various syntax's and it still seems to complain.

I want to display multiple forms for example, if the 1st range is selected, i want to show the 1st form if the second range is selected then ill want to show the second form, making way for the 'is nothing' of course. In time im sure there will be a 3rd form but that shouldnt be a problem once i have the correct syntax.

Thanks,


If Intersect(Target, Range("$B$11:$B$45")) Is Nothing Then Exit Sub
UserForm1.Show vbModeless

If Intersect(Target, Range("$D$11:$D$45")) Is Nothing Then Exit Sub
WSFilter
CreateWSList
UserForm2.Show vbModeless
 
What kind of routine is it? If it is event code, as it appears, what event is it?
 
Upvote 0

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Well teh code before i put in to sub:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
If Not Intersect(Target, Range("B11:B45")) Is Nothing Then
UserForm1.Show vbModeless
ElseIf Not Intersect(Target, Range("D11:D45")) Is Nothing Then
WSFilter
CreateWSList
UserForm2.Show vbModeless
ElseIf Not Intersect(Target, Range("H11:H45")) Is Nothing Then
UserForm3.Show vbModeless
End If
(I have added a 3rd full a minute ago, this works fine and it brings up the second form still)


Could this be causing it:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("D11:D46")) Is Nothing Then
Application.EnableEvents = False
Target.Value = UCase(Target.Value)
Application.EnableEvents = True
End If
End Sub

Other code is for button clicks on the spreadsheet.

Thanks,
 
Upvote 0
Are you clicking on a locked cell, or double-clicking it? If you double-click it, then the double-click acts based on the active cell (which cannot be the locked one) so if the active cell is in D11:D45, then you will see the second form.
 
Upvote 0
Wow, spot on! as before i just happened to be in the second range it was form 2 but didnt check that.

I was double clicking the locked cell whilst in the range specified.

Thanks for your help, it all makes sense now :D

However, i dont suppose theres a way to counter act this?
 
Upvote 0
You' have to allow selecting locked cells I think. (or use some funky API stuff to work out the location of the mouse pointer)
 
Upvote 0

Forum statistics

Threads
1,223,721
Messages
6,174,096
Members
452,542
Latest member
Bricklin

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top