Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi why wont this work for a command button, what should I write instead?
Private Sub CommandButton3_Click() If Not Intersect(Target, Range("patientlist")) Is Nothing Then UserForm2.TextBox1.Value = ActiveCell.Value UserForm2.Show End If End Sub |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
What is target? Event subs have target as a parameter. Yours does not define
target anywhere. Perhaps activecell Private Sub CommandButton3_Click() If Not Intersect(activcell, Range("patientlist")) Is Nothing Then UserForm2.TextBox1.Value = ActiveCell.Value UserForm2.Show End If End Sub -- HTH... Jim Thomlinson "Atishoo" wrote: Hi why wont this work for a command button, what should I write instead? Private Sub CommandButton3_Click() If Not Intersect(Target, Range("patientlist")) Is Nothing Then UserForm2.TextBox1.Value = ActiveCell.Value UserForm2.Show End If End Sub |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
thank you!!
"Jim Thomlinson" wrote: What is target? Event subs have target as a parameter. Yours does not define target anywhere. Perhaps activecell Private Sub CommandButton3_Click() If Not Intersect(activcell, Range("patientlist")) Is Nothing Then UserForm2.TextBox1.Value = ActiveCell.Value UserForm2.Show End If End Sub -- HTH... Jim Thomlinson "Atishoo" wrote: Hi why wont this work for a command button, what should I write instead? Private Sub CommandButton3_Click() If Not Intersect(Target, Range("patientlist")) Is Nothing Then UserForm2.TextBox1.Value = ActiveCell.Value UserForm2.Show End If End Sub |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
This code should go into Worksheet_Change(ByVal Target As Range) or
Worksheet_SelectionChange(ByVal Target As Range) events. Test what the 'Target' is when you click on the button... "Atishoo" wrote: Hi why wont this work for a command button, what should I write instead? Private Sub CommandButton3_Click() If Not Intersect(Target, Range("patientlist")) Is Nothing Then UserForm2.TextBox1.Value = ActiveCell.Value UserForm2.Show End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
command button add another command | Excel Discussion (Misc queries) | |||
Command Button | Excel Discussion (Misc queries) | |||
Command Button | Excel Worksheet Functions | |||
Command Button | Excel Worksheet Functions | |||
command button | Excel Discussion (Misc queries) |