<code style="margin: 0px; padding: 0px; border: 0px; font-style: inherit; font-variant: inherit; font-weight: inherit; font-stretch: inherit; line-height: inherit; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; vertical-align: baseline; box-sizing: inherit; white-space: inherit;">All,
I'm not sure why my code is not working exactly as expected. Only when the first cell is selected, a message box should popup with instructions on how to change the date/time. I would like to click on a cell that is linked to DTPicker1, change the date/time then click the cell again to enter.
What happens on first cell select, the message does pop up and I am able to change the date/time. What doesn't happen is that once the cell is selected, I am am to change the date/time but when I click back on the cell to enter nothing happens until the cell below is selected and it is not in the correct format. I have to make changes on the new cell then come back to select the original cell in order for the changes to be inputed. Also The randomize routines key running on every slection change. Any help would be greatly appreciated!!!
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode as Integer, ByVal Shift
as Integer, ByVal Callbackfield as String, ByVal CallbackDate as Date)
End Sub
Private Sub Worksheet_Selectionchange(ByVal Target as Range)
If not Intersect(Target, Range("a3")) is nothing then
Msgbox (“To change the date/time, Select the number and use the arrows.”)
End if
With Sheet1.DTPicker1
.Height = 20
.Width = 125
.Format = dtpCustom
.CustomFormat = "ddHHmmZMMMyy"
If Not intersect(Target, Range("a3:a502")) is nothing then
.Visible = True
.Top = Target.Top
.Left = Target.offset(0,1).left
.Linkedcell = Target.address
Me.Range(DTPicker1.LinkedCell)= Format(DTPicker1.value,Me.Range("a3").NumberFormat)
Else
.Visible = False
End If
End With
If not intersect(Target, Range("b3:b502")) is nothing then
Randomize
Target.value=StaticRand()
End if
If not intersect(Target, Range("c3:c502")) is nothing then
Randomize
Target.Value = Int((6-1+1)* StaticRand+1)
If Range("b3").value < 0.25 then
Target.value =target.value & "NO COVERAGE"
End if</code>
I'm not sure why my code is not working exactly as expected. Only when the first cell is selected, a message box should popup with instructions on how to change the date/time. I would like to click on a cell that is linked to DTPicker1, change the date/time then click the cell again to enter.
What happens on first cell select, the message does pop up and I am able to change the date/time. What doesn't happen is that once the cell is selected, I am am to change the date/time but when I click back on the cell to enter nothing happens until the cell below is selected and it is not in the correct format. I have to make changes on the new cell then come back to select the original cell in order for the changes to be inputed. Also The randomize routines key running on every slection change. Any help would be greatly appreciated!!!
Private Sub DTPicker1_CallbackKeyDown(ByVal KeyCode as Integer, ByVal Shift
as Integer, ByVal Callbackfield as String, ByVal CallbackDate as Date)
End Sub
Private Sub Worksheet_Selectionchange(ByVal Target as Range)
If not Intersect(Target, Range("a3")) is nothing then
Msgbox (“To change the date/time, Select the number and use the arrows.”)
End if
With Sheet1.DTPicker1
.Height = 20
.Width = 125
.Format = dtpCustom
.CustomFormat = "ddHHmmZMMMyy"
If Not intersect(Target, Range("a3:a502")) is nothing then
.Visible = True
.Top = Target.Top
.Left = Target.offset(0,1).left
.Linkedcell = Target.address
Me.Range(DTPicker1.LinkedCell)= Format(DTPicker1.value,Me.Range("a3").NumberFormat)
Else
.Visible = False
End If
End With
If not intersect(Target, Range("b3:b502")) is nothing then
Randomize
Target.value=StaticRand()
End if
If not intersect(Target, Range("c3:c502")) is nothing then
Randomize
Target.Value = Int((6-1+1)* StaticRand+1)
If Range("b3").value < 0.25 then
Target.value =target.value & "NO COVERAGE"
End if</code>