Consulting

Results 1 to 3 of 3

Thread: is it possible: If Me.Controls("CommandButton" & i).clicked

  1. #1

    is it possible: If Me.Controls("CommandButton" & i).clicked

    hello
    is it possible:

    If Me.Controls("CommandButton" & i).clicked Then
    Sheets("tt").Range("C" & i).Value = Me.Controls("CommandButton" & i).Caption
    End If

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    You could build a Class for Command Buttons or
    Private Sub CommandButton1_Click()
    Call FillCell(1)
    End Sub
    Private Sub CommandButton2_Click()
    Call FillCell(2)
    End Sub
    
    
    Sub FillCell(i)
    Sheets("tt").Range("C" & i).Value = Me.Controls("CommandButton" & i).Caption
    End Sub
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    thank you very much

Posting Permissions

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