Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
Default Referring to BeforeDoubleClick

Hello All:

I have a VBA Code Using the BeforeDoubleClick.
My Question is how do I refer to that Sub?

I want to make that if the user selects from a userform option 1 then
BeforeDoubleClick should one way, if user selects option 2 then
BeforeDoubleClick should work differently. Is there a way to do this? How Can
I do this? Below are the BeforeDoubleClick code and the userform code that I
want to use.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell
If IsNumeric(Target.Value) Then
Target.Value = Target.Value + 1
End If
End Sub



Private Sub OKButton_Click()
On Error Resume Next
If optionRightAdd Then
Run Macro50
End If
If OptionLeftAdd Then
Run Macro51
End If
Unload UserForm1
End Sub

Thanks in Advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Referring to BeforeDoubleClick

You could create a public variable in a General module -- not behind the
worksheet and not in the userform's code.

Public myOption as long 'or boolean

Then change that value to whatever you need in the code for the userform.

Then you can check that variable's value in your event code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell

if myoption = 1 then
'do the stuff for option 1
else
'do the stuff for option 2
end if

End Sub

art wrote:

Hello All:

I have a VBA Code Using the BeforeDoubleClick.
My Question is how do I refer to that Sub?

I want to make that if the user selects from a userform option 1 then
BeforeDoubleClick should one way, if user selects option 2 then
BeforeDoubleClick should work differently. Is there a way to do this? How Can
I do this? Below are the BeforeDoubleClick code and the userform code that I
want to use.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell
If IsNumeric(Target.Value) Then
Target.Value = Target.Value + 1
End If
End Sub

Private Sub OKButton_Click()
On Error Resume Next
If optionRightAdd Then
Run Macro50
End If
If OptionLeftAdd Then
Run Macro51
End If
Unload UserForm1
End Sub

Thanks in Advance.


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
Default Referring to BeforeDoubleClick

Thanks for your help, but I don't understand exactly.
I assume that you want to make MyOptions public.
But where do I put in What?

I have the Userform code and the Module code containing the
BeforeDoubleClick Code. Now, what do I do now? What should I place in the new
module which code? And What should I change in the other ones?

Thanks for your help. Please help me thru, until the end.

Thanks again.

"Dave Peterson" wrote:

You could create a public variable in a General module -- not behind the
worksheet and not in the userform's code.

Public myOption as long 'or boolean

Then change that value to whatever you need in the code for the userform.

Then you can check that variable's value in your event code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell

if myoption = 1 then
'do the stuff for option 1
else
'do the stuff for option 2
end if

End Sub

art wrote:

Hello All:

I have a VBA Code Using the BeforeDoubleClick.
My Question is how do I refer to that Sub?

I want to make that if the user selects from a userform option 1 then
BeforeDoubleClick should one way, if user selects option 2 then
BeforeDoubleClick should work differently. Is there a way to do this? How Can
I do this? Below are the BeforeDoubleClick code and the userform code that I
want to use.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell
If IsNumeric(Target.Value) Then
Target.Value = Target.Value + 1
End If
End Sub

Private Sub OKButton_Click()
On Error Resume Next
If optionRightAdd Then
Run Macro50
End If
If OptionLeftAdd Then
Run Macro51
End If
Unload UserForm1
End Sub

Thanks in Advance.


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Referring to BeforeDoubleClick

I'm not sure I understand.

You'd still make the variable public and put it in a General module.

Then in the userform code:

Private Sub OKButton_Click()
On Error Resume Next
If optionRightAdd Then
myOption = 1
Run Macro50
End If
If OptionLeftAdd Then
myoption = 2
Run Macro51
End If
Unload UserForm1
End Sub

Then the _BeforeDoubleclick would use that variable (like in the previous post).

art wrote:

Thanks for your help, but I don't understand exactly.
I assume that you want to make MyOptions public.
But where do I put in What?

I have the Userform code and the Module code containing the
BeforeDoubleClick Code. Now, what do I do now? What should I place in the new
module which code? And What should I change in the other ones?

Thanks for your help. Please help me thru, until the end.

Thanks again.

"Dave Peterson" wrote:

You could create a public variable in a General module -- not behind the
worksheet and not in the userform's code.

Public myOption as long 'or boolean

Then change that value to whatever you need in the code for the userform.

Then you can check that variable's value in your event code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell

if myoption = 1 then
'do the stuff for option 1
else
'do the stuff for option 2
end if

End Sub

art wrote:

Hello All:

I have a VBA Code Using the BeforeDoubleClick.
My Question is how do I refer to that Sub?

I want to make that if the user selects from a userform option 1 then
BeforeDoubleClick should one way, if user selects option 2 then
BeforeDoubleClick should work differently. Is there a way to do this? How Can
I do this? Below are the BeforeDoubleClick code and the userform code that I
want to use.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell
If IsNumeric(Target.Value) Then
Target.Value = Target.Value + 1
End If
End Sub

Private Sub OKButton_Click()
On Error Resume Next
If optionRightAdd Then
Run Macro50
End If
If OptionLeftAdd Then
Run Macro51
End If
Unload UserForm1
End Sub

Thanks in Advance.


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
Default Referring to BeforeDoubleClick

Can you please tell me the full code that I should put in the General module
to make the variable public and put it in a General module?



Thanks for your help.




"Dave Peterson" wrote:

I'm not sure I understand.

You'd still make the variable public and put it in a General module.

Then in the userform code:

Private Sub OKButton_Click()
On Error Resume Next
If optionRightAdd Then
myOption = 1
Run Macro50
End If
If OptionLeftAdd Then
myoption = 2
Run Macro51
End If
Unload UserForm1
End Sub

Then the _BeforeDoubleclick would use that variable (like in the previous post).

art wrote:

Thanks for your help, but I don't understand exactly.
I assume that you want to make MyOptions public.
But where do I put in What?

I have the Userform code and the Module code containing the
BeforeDoubleClick Code. Now, what do I do now? What should I place in the new
module which code? And What should I change in the other ones?

Thanks for your help. Please help me thru, until the end.

Thanks again.

"Dave Peterson" wrote:

You could create a public variable in a General module -- not behind the
worksheet and not in the userform's code.

Public myOption as long 'or boolean

Then change that value to whatever you need in the code for the userform.

Then you can check that variable's value in your event code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell

if myoption = 1 then
'do the stuff for option 1
else
'do the stuff for option 2
end if

End Sub

art wrote:

Hello All:

I have a VBA Code Using the BeforeDoubleClick.
My Question is how do I refer to that Sub?

I want to make that if the user selects from a userform option 1 then
BeforeDoubleClick should one way, if user selects option 2 then
BeforeDoubleClick should work differently. Is there a way to do this? How Can
I do this? Below are the BeforeDoubleClick code and the userform code that I
want to use.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell
If IsNumeric(Target.Value) Then
Target.Value = Target.Value + 1
End If
End Sub

Private Sub OKButton_Click()
On Error Resume Next
If optionRightAdd Then
Run Macro50
End If
If OptionLeftAdd Then
Run Macro51
End If
Unload UserForm1
End Sub

Thanks in Advance.

--

Dave Peterson


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Referring to BeforeDoubleClick

Public myOption as long 'or boolean



art wrote:

Can you please tell me the full code that I should put in the General module
to make the variable public and put it in a General module?

Thanks for your help.

"Dave Peterson" wrote:

I'm not sure I understand.

You'd still make the variable public and put it in a General module.

Then in the userform code:

Private Sub OKButton_Click()
On Error Resume Next
If optionRightAdd Then
myOption = 1
Run Macro50
End If
If OptionLeftAdd Then
myoption = 2
Run Macro51
End If
Unload UserForm1
End Sub

Then the _BeforeDoubleclick would use that variable (like in the previous post).

art wrote:

Thanks for your help, but I don't understand exactly.
I assume that you want to make MyOptions public.
But where do I put in What?

I have the Userform code and the Module code containing the
BeforeDoubleClick Code. Now, what do I do now? What should I place in the new
module which code? And What should I change in the other ones?

Thanks for your help. Please help me thru, until the end.

Thanks again.

"Dave Peterson" wrote:

You could create a public variable in a General module -- not behind the
worksheet and not in the userform's code.

Public myOption as long 'or boolean

Then change that value to whatever you need in the code for the userform.

Then you can check that variable's value in your event code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell

if myoption = 1 then
'do the stuff for option 1
else
'do the stuff for option 2
end if

End Sub

art wrote:

Hello All:

I have a VBA Code Using the BeforeDoubleClick.
My Question is how do I refer to that Sub?

I want to make that if the user selects from a userform option 1 then
BeforeDoubleClick should one way, if user selects option 2 then
BeforeDoubleClick should work differently. Is there a way to do this? How Can
I do this? Below are the BeforeDoubleClick code and the userform code that I
want to use.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell
If IsNumeric(Target.Value) Then
Target.Value = Target.Value + 1
End If
End Sub

Private Sub OKButton_Click()
On Error Resume Next
If optionRightAdd Then
Run Macro50
End If
If OptionLeftAdd Then
Run Macro51
End If
Unload UserForm1
End Sub

Thanks in Advance.

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
Art Art is offline
external usenet poster
 
Posts: 587
Default Referring to BeforeDoubleClick

Thanks I finally got it.



"Dave Peterson" wrote:

Public myOption as long 'or boolean



art wrote:

Can you please tell me the full code that I should put in the General module
to make the variable public and put it in a General module?

Thanks for your help.

"Dave Peterson" wrote:

I'm not sure I understand.

You'd still make the variable public and put it in a General module.

Then in the userform code:

Private Sub OKButton_Click()
On Error Resume Next
If optionRightAdd Then
myOption = 1
Run Macro50
End If
If OptionLeftAdd Then
myoption = 2
Run Macro51
End If
Unload UserForm1
End Sub

Then the _BeforeDoubleclick would use that variable (like in the previous post).

art wrote:

Thanks for your help, but I don't understand exactly.
I assume that you want to make MyOptions public.
But where do I put in What?

I have the Userform code and the Module code containing the
BeforeDoubleClick Code. Now, what do I do now? What should I place in the new
module which code? And What should I change in the other ones?

Thanks for your help. Please help me thru, until the end.

Thanks again.

"Dave Peterson" wrote:

You could create a public variable in a General module -- not behind the
worksheet and not in the userform's code.

Public myOption as long 'or boolean

Then change that value to whatever you need in the code for the userform.

Then you can check that variable's value in your event code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell

if myoption = 1 then
'do the stuff for option 1
else
'do the stuff for option 2
end if

End Sub

art wrote:

Hello All:

I have a VBA Code Using the BeforeDoubleClick.
My Question is how do I refer to that Sub?

I want to make that if the user selects from a userform option 1 then
BeforeDoubleClick should one way, if user selects option 2 then
BeforeDoubleClick should work differently. Is there a way to do this? How Can
I do this? Below are the BeforeDoubleClick code and the userform code that I
want to use.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel As Boolean)
If Target.Cells.Count 1 Then Exit Sub

Cancel = True 'stop editing in cell
If IsNumeric(Target.Value) Then
Target.Value = Target.Value + 1
End If
End Sub

Private Sub OKButton_Click()
On Error Resume Next
If optionRightAdd Then
Run Macro50
End If
If OptionLeftAdd Then
Run Macro51
End If
Unload UserForm1
End Sub

Thanks in Advance.

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson

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
Help With BeforeDoubleClick jean Excel Programming 3 March 19th 08 07:02 PM
BeforeDoubleClick Stefi Excel Programming 7 December 20th 07 10:13 AM
beforedoubleclick and selectionchange clara Excel Programming 0 April 24th 07 06:52 PM
BeforeDoubleClick doesn't seem to work Dan Excel Programming 7 March 13th 07 03:22 AM
BeforeDoubleClick processing question(s) Forms / Send to .....VBA or Macro? Excel Programming 2 November 8th 06 04:06 AM


All times are GMT +1. The time now is 03:43 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"