Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Showing information according to a selection in a drop down box | Excel Worksheet Functions | |||
cell selection code | Excel Discussion (Misc queries) | |||
Why is a cell formatted as a zip code is showing up as a decimal? | Excel Discussion (Misc queries) | |||
Enhancement request for showing the selection of rows in MS Excel | Excel Worksheet Functions | |||
REPOST: showing a userform | Excel Programming |