Consulting

Results 1 to 2 of 2

Thread: Worksheet change - single click>value entered

  1. #1

    Worksheet change - single click>value entered

    Hi,

    Is it possible to set up a worksheet change function so that if a user single clicks a cell a value is entered automatically into that cell? If so, can the function allow for the use of the delete button?

    I guess a single click toggle between no value & the specified value?

    All I've been able to come up with is below, but I'm still quite new to worksheet changes, etc. It requires a double click, and delete won't work (because it entails more clicks!).

    Thanks.

    [vba]Private Sub Worksheet_Change(ByVal Target As Range)

    If Target.Cells.Count > 1 Then Exit Sub
    Target.Value = "Nil"
    End Sub[/vba]

  2. #2
    VBAX Tutor nst1107's Avatar
    Joined
    Nov 2008
    Location
    Monticello
    Posts
    245
    Location
    I don't think this is everything you want, but see if it helps:[VBA]Option Explicit
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Intersect(Target, Cells(1, 1)) Is Nothing Then Exit Sub
    Application.EnableEvents = False
    Target.Offset(1).Activate
    Application.EnableEvents = True
    If Target = vbNullString Then Target = 1: Exit Sub
    If Target = 1 Then Target = vbNullString
    End Sub
    [/VBA]

Posting Permissions

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