S
SuitedAces
*Please help with this*, I am using 2 button presses to swap ranges
( I have 30 ranges and 30 buttons)
and I am using Ontime to kill and reset the code if the user doesn't
press the second button within 4 seconds of the first button press.
They way I am using the Ontime function is taken directly
out of EXCEL help yet it results in .... unable to find the function
(ResetTheFirstManualSwapButton)
I only am setting the values in B2 just to watch the results of th
flow of the code before I add the code needed to do the swapping
*******************************************************
Public Sub ManualSwap(SwapPosition As Integer)
If FirstButtonPress = 0 Then
FirstButtonPress = SwapPosition
Range("B2").Select
Selection.Value = FirstButtonPress
'give the user 4 seconds to choose the second range in the swap
'Application.OnTime Now + TimeValue("00:00:4")
ResetTheFirstManualSwapButton
Else
'There are now 2 variables for the 2 ranges
'run some code here to swap the ranges
'set the to FirstButtonPress = 0 ready for the next swap
FirstButtonPress = 0
Range("B2").Select
Selection.Value = FirstButtonPress
End If
End Sub
*******************************************************
Public Function ResetTheFirstManualSwapButton()
' the user waited too long so reset the to FirstButtonPress = 0
Dim FirstButtonPress As Integer
FirstButtonPress = 0
Range("B2").Select
Selection.Value = FirstButtonPress
End Function
If I can get past this obstacle I will be able to complete the code fo
these
swap buttons. *Your help is appreciated
( I have 30 ranges and 30 buttons)
and I am using Ontime to kill and reset the code if the user doesn't
press the second button within 4 seconds of the first button press.
They way I am using the Ontime function is taken directly
out of EXCEL help yet it results in .... unable to find the function
(ResetTheFirstManualSwapButton)
I only am setting the values in B2 just to watch the results of th
flow of the code before I add the code needed to do the swapping
*******************************************************
Public Sub ManualSwap(SwapPosition As Integer)
If FirstButtonPress = 0 Then
FirstButtonPress = SwapPosition
Range("B2").Select
Selection.Value = FirstButtonPress
'give the user 4 seconds to choose the second range in the swap
'Application.OnTime Now + TimeValue("00:00:4")
ResetTheFirstManualSwapButton
Else
'There are now 2 variables for the 2 ranges
'run some code here to swap the ranges
'set the to FirstButtonPress = 0 ready for the next swap
FirstButtonPress = 0
Range("B2").Select
Selection.Value = FirstButtonPress
End If
End Sub
*******************************************************
Public Function ResetTheFirstManualSwapButton()
' the user waited too long so reset the to FirstButtonPress = 0
Dim FirstButtonPress As Integer
FirstButtonPress = 0
Range("B2").Select
Selection.Value = FirstButtonPress
End Function
If I can get past this obstacle I will be able to complete the code fo
these
swap buttons. *Your help is appreciated