Two ByVal Target As Range choices on same sheet

2mutch

New Member
Joined
Oct 11, 2009
Messages
15
****** name="Title" content=""> ****** name="Keywords" content=""> ****** http-equiv="Content-Type" content="text/html; charset=utf-8"> ****** name="ProgId" content="Word.Document"> ****** name="Generator" content="Microsoft Word 11"> ****** name="Originator" content="Microsoft Word 11"> <link rel="File-List" href="file://localhost/Users/sinclair/.Trash/Recovered%20files/msoclip1/01/clip_filelist.xml"> <!--[if gte mso 9]><xml> <o:DocumentProperties> <o:Template>Normal</o:Template> <o:Revision>0</o:Revision> <o:TotalTime>0</o:TotalTime> <o:Pages>1</o:Pages> <o:Words>78</o:Words> <o:Characters>450</o:Characters> <o:Company>BesTel Solutions, Inc.</o:Company> <o:Lines>3</o:Lines> <o:Paragraphs>1</o:Paragraphs> <o:CharactersWithSpaces>552</o:CharactersWithSpaces> <o:Version>11.1282</o:Version> </o:DocumentProperties> <o:OfficeDocumentSettings> <o:AllowPNG/> </o:OfficeDocumentSettings> </xml><![endif]--><!--[if gte mso 9]><xml> <w:WordDocument> <w:Zoom>0</w:Zoom> <w:DoNotShowRevisions/> <w:DoNotPrintRevisions/> <w:DisplayHorizontalDrawingGridEvery>0</w:DisplayHorizontalDrawingGridEvery> <w:DisplayVerticalDrawingGridEvery>0</w:DisplayVerticalDrawingGridEvery> <w:UseMarginsForDrawingGridOrigin/> </w:WordDocument> </xml><![endif]--> <style> <!-- /* Font Definitions */ @font-face {font-family:"Times New Roman"; panose-1:0 2 2 6 3 5 4 5 2 3; mso-font-charset:0; mso-generic-font-family:auto; mso-font-pitch:variable; mso-font-signature:50331648 0 0 0 1 0;} /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman";} table.MsoNormalTable {mso-style-parent:""; font-size:10.0pt; font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> </style> <!--StartFragment--> I am using the following VBA to display a form if the user clicks in a cell in column 7. I would like to display one form if they click in column 6 and another form if they click in column 7. Is that possible
<!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p>
Thanks for the help in advance
<!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p>
<!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p>
Private Sub Worksheet_SelectionChange(ByVal Target As Range)<o:p></o:p>
If Target.Column <> 7 Then<o:p></o:p>
Exit Sub<o:p></o:p>
End If<o:p></o:p>
UserForm1.TextBox1.Text = Target.Value<o:p></o:p>
UserForm1.TextBox1.WordWrap = True<o:p></o:p>
UserForm1.TextBox1.MultiLine = True<o:p></o:p>
<!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p>
If UserForm1.Visible = True Then<o:p></o:p>
DoEvents<o:p></o:p>
Else<o:p></o:p>
UserForm1.Show<o:p></o:p>
End If<o:p></o:p>
End Sub<o:p></o:p>
<!--[if !supportEmptyParas]--> <!--[endif]--><o:p></o:p>
<!--EndFragment-->
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
A lot of html junk in your post, but sifting through it for recognizable English, maybe this syntax is what you are asking for:

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Select Case Target.Column
Case 6
UserForm1.Show
Case 7
UserForm2.Show
End Select
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,237
Messages
6,170,924
Members
452,366
Latest member
TePunaBloke

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