PDA

View Full Version : Solved: Tabbing Issue



coliervile
04-13-2007, 09:44 AM
With the assistance of "XLD" I had resolved the issue of tabbing through input cells , used for checkmarks, that were protected and not putting a checkmark in the cell when tabbed to. Now the issue is when a checkmark is in the cell and the user tabs through the input cells it takes the checkmarks out. Is there any way of tabbing through without deleting the checkmarks. I know a simple solution would be to instruct the users to mouse to these cells and click on them, but is there another way around it???? :banghead: :dunno :bug:

Best regards,

Charlie

coliervile
04-15-2007, 02:16 AM
I was wondering can there be two "Private Sub Worksheet_BeforeDoubleClick" on the same worksheet? If not can this "Private Sub Worksheet_SelectionChange" used for checkmarks be incorporated into this "Private Sub Worksheet_BeforeDoubleClick" used to input dates? Both of the following codes are on worksheet named "Input".

Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim CheckmarkCells As Range
Set CheckmarkCells = Range("A20,A22,A24,A28,A30,A37,A41,E45,E47,E49,A62,A64,A66,A68")
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, CheckmarkCells) Is Nothing Then
Me.Unprotect Password:="password"
If Target.Font.Name = "Marlett" Then
Target.ClearContents
Target.Font.Name = "Arial"
' Range("G16").Select
Target.Offset(0, 1).Select
Else
Target.Value = "a"
Target.Font.Name = "Marlett"
' Range("G16").Select
Target.Offset(0, 1).Select
End If
Me.Protect Password:="password"
End If
End Sub
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("E5,E15,T60")) Is Nothing Then
Target.Value = Date
Cancel = True
End If
End Sub

Best regards,
Charlie

Bob Phillips
04-15-2007, 05:29 AM
There cannot be two, but it can do two things, either to the same Target, or it can test Target and do one of two things depending upon what the range is.

coliervile
04-15-2007, 08:25 AM
Thanks "xld" for responding....do you have an example?

Regards,
Charlie

Bob Phillips
04-15-2007, 08:58 AM
Give us the two things you want to do and I will construct one.

coliervile
04-15-2007, 11:52 AM
Here's what I wanting to do....I want the user to be able to tab through the "worksheet form" and the cells that would contain checkmarks and the current date (currently run by a doubleclick event) without removing the checkmarks or dates. I want the checkmarks and dates to run off the doubleclick macro. I think this would resolve my issue...does this make sense?

Regards,
Charlie

coliervile
04-15-2007, 02:16 PM
"XLD" here's a copy of the worksheet form with Private Sub Worksheet_BeforeDoubleClickfor the dates, if this helps you help me?

Regards,

Charlie

coliervile
04-15-2007, 03:40 PM
"XLD" I came up with this coding which seems to work and tab through the input cells without removing the checkmarks. Take a look at the workbook and see what you think.

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("E5,E15,T60")) Is Nothing Then
Me.Unprotect Password:="password"
Target.Value = Date
Cancel = True
End If
Me.Protect Password:="password"

If Not Intersect(Target, Range("A20,A22,A24,A28,A30,A37,A41,E45,E47,E49,A62,A64,A66,A68")) Is Nothing Then
Me.Unprotect Password:="password"
If Target.Font.Name = "Marlett" Then
Target.ClearContents
Target.Font.Name = "Arial"
Target.Offset(0, 1).Select
Else

Target.Value = "a"
Target.Font.Name = "Marlett"
Target.Offset(0, 1).Select
End If
Me.Protect Password:="password"

End If
End Sub


Best Regards,

Charlie

coliervile
04-15-2007, 03:58 PM
New issue came up; when I doubleclick to remove the dates, the dates stay in the cell????

coliervile
04-16-2007, 02:30 AM
Solved my issue with the following code;

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("E5,E15,U60")) Is Nothing Then
Me.Unprotect Password:="password"
If Target.Value = Date Then Target.Value = "" Else Target.Value = Date
Cancel = True
End If
Me.Protect Password:="password"

If Not Intersect(Target, Range("A20,A22,A24,A28,A30,A37,A41,E45,E47,E49,A62,A64,A66,A68")) Is Nothing Then
Me.Unprotect Password:="password"
If Target.Font.Name = "Marlett" Then
Target.ClearContents
Target.Font.Name = "Arial"
Target.Offset(0, 1).Select
Else

Target.Value = "a"
Target.Font.Name = "Marlett"
Target.Offset(0, 1).Select
End If
Me.Protect Password:="password"

End If
End Sub


Regards,

Charlie