Consulting

Results 1 to 10 of 10

Thread: Solved: Tabbing Issue

  1. #1
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location

    Solved: Tabbing Issue

    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????

    Best regards,

    Charlie

  2. #2
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location
    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".

    [VBA] 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[/VBA]

    Best regards,
    Charlie

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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.

  4. #4
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location
    Thanks "xld" for responding....do you have an example?

    Regards,
    Charlie

  5. #5
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Give us the two things you want to do and I will construct one.

  6. #6
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location
    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

  7. #7
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location
    "XLD" here's a copy of the worksheet form with Private Sub Worksheet_BeforeDoubleClickfor the dates, if this helps you help me?

    Regards,

    Charlie

  8. #8
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location
    "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

  9. #9
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location
    New issue came up; when I doubleclick to remove the dates, the dates stay in the cell????

  10. #10
    VBAX Expert
    Joined
    May 2006
    Location
    Oklahoma City, OK
    Posts
    532
    Location
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •