Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default code for showing userform on cell selection

Hi
I want to have a userform show up on selection of specified cells (say A1,
C2 and D5) and the userform to disappear when the selection is moved to
other cells. Could someone please suggest a code for this?
Thanks in advance

M P Reddy
--




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 218
Default code for showing userform on cell selection

Paste the following to the code module pertaining to the
worksheet involved:

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
Select Case Target.Address
Case "$A$1", "$C$2", "$D$5"
UserForm1.Show
Case Else
Unload UserForm1
End Select
End Sub

Regards,
Greg

-----Original Message-----
Hi
I want to have a userform show up on selection of

specified cells (say A1,
C2 and D5) and the userform to disappear when the

selection is moved to
other cells. Could someone please suggest a code for this?
Thanks in advance

M P Reddy
--




.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default code for showing userform on cell selection

A slight alternative.

Select the cells and give them a workbook name, such as FormCells. Then this
code in the worksheet code module as before

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Intersect(Target,Range("FormCells")) Is Nothing Then
Userform1.Show
End If

End Sub

This way you can add to your target cells without changing code by amending
the workbook name in Excel.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Greg Wilson" wrote in message
...
Paste the following to the code module pertaining to the
worksheet involved:

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
Select Case Target.Address
Case "$A$1", "$C$2", "$D$5"
UserForm1.Show
Case Else
Unload UserForm1
End Select
End Sub

Regards,
Greg

-----Original Message-----
Hi
I want to have a userform show up on selection of

specified cells (say A1,
C2 and D5) and the userform to disappear when the

selection is moved to
other cells. Could someone please suggest a code for this?
Thanks in advance

M P Reddy
--




.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default code for showing userform on cell selection

Thanks a lot Greg and Bob
M P Reddy
Bob Phillips wrote in message
...
A slight alternative.

Select the cells and give them a workbook name, such as FormCells. Then

this
code in the worksheet code module as before

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Not Intersect(Target,Range("FormCells")) Is Nothing Then
Userform1.Show
End If

End Sub

This way you can add to your target cells without changing code by

amending
the workbook name in Excel.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Greg Wilson" wrote in message
...
Paste the following to the code module pertaining to the
worksheet involved:

Private Sub Worksheet_SelectionChange(ByVal Target As
Range)
Select Case Target.Address
Case "$A$1", "$C$2", "$D$5"
UserForm1.Show
Case Else
Unload UserForm1
End Select
End Sub

Regards,
Greg

-----Original Message-----
Hi
I want to have a userform show up on selection of

specified cells (say A1,
C2 and D5) and the userform to disappear when the

selection is moved to
other cells. Could someone please suggest a code for this?
Thanks in advance

M P Reddy
--




.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Showing information according to a selection in a drop down box Callum W Excel Worksheet Functions 2 August 18th 09 01:54 PM
cell selection code NDBC Excel Discussion (Misc queries) 6 August 11th 09 06:39 AM
Why is a cell formatted as a zip code is showing up as a decimal? Renee' Excel Discussion (Misc queries) 4 February 14th 07 12:30 PM
Enhancement request for showing the selection of rows in MS Excel Purushottam Abuj Excel Worksheet Functions 0 February 10th 06 12:20 PM
REPOST: showing a userform boris Excel Programming 2 August 6th 03 02:30 AM


All times are GMT +1. The time now is 11:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"