❓ Help How to make forms in excel 2 (bot)

How to make a form in excel which can do the following:
1. Form can search a data from the column 1
2. After searching the data, buttons with name of columns should appear.
3. As I click each button with column names, it should input numbers for its entire row only based on how many times I clicked the button.
4. After clicking ok, the form should appear again for searching another data.
 
To create a form in Excel with the specified functionalities, you can follow these steps using VBA (Visual Basic for Applications):

1. Press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
2. Go to Insert > UserForm to create a new UserForm.
3. Design your UserForm with necessary elements like text boxes, buttons, labels, etc.
4. Add the following VBA code to the UserForm module:

Code:
Option Explicit

Private Sub UserForm_Initialize()
    'Initialize the UserForm
    'Add code to populate the form elements as needed
End Sub

Private Sub SearchButton_Click()
    'Search for data from Column 1
    Dim searchTerm As String
    searchTerm = TextBox1.Value
    
    'Add code to search for the data in Column 1
    
    'Display buttons with column names
    'Assuming you have Column Names in an array named columnArray
    Dim i As Integer
    For i = LBound(columnArray) To UBound(columnArray)
        Dim newButton As MSForms.CommandButton
        Set newButton = Me.Controls.Add("Forms.CommandButton.1", "Button_" & i, True)
        newButton.Caption = columnArray(i)
        newButton.Left = 10
        newButton.Top = 30 + (i * 20)
        newButton.Width = 100
        newButton.Height = 20
        newButton.Tag = i
        AddHandler newButton.Click, AddressOf Button_Click
    Next i
End Sub

Private Sub Button_Click()
    'Handle button click event
    Dim clickedButton As MSForms.CommandButton
    Set clickedButton = Me.Controls(Application.Caller)
    
    Dim columnIndex As Integer
    columnIndex = clickedButton.Tag
    
    'Input numbers for the entire row based on how many times the button is clicked
    Dim numRows As Integer
    numRows = 'Get the number of times the button is clicked
    
    'Add code to input numbers for the entire row
    
End Sub

Private Sub OKButton_Click()
    'Handle OK button click event
    'Clear the UserForm and reset for another search
    'Add code to clear form elements
End Sub

5. Modify the code as per your specific requirements and data structure. Update the code to search for data in Column 1, populate buttons with column names, input numbers based on button clicks, and handle the OK button click event.
6. Close the VBA editor and save the workbook as a macro-enabled workbook (.xlsm).
7. Insert a button or use a shortcut key to show the UserForm you created.

This code provides a basic framework to achieve the functionalities you mentioned. You can customize and expand upon it to suit your exact needs.
 
To create a form in Excel with the specified functionalities, you can follow these steps using VBA (Visual Basic for Applications):

1. Press Alt + F11 to open the Visual Basic for Applications (VBA) editor.
2. Go to Insert > UserForm to create a new UserForm.
3. Design your UserForm with necessary elements like text boxes, buttons, labels, etc.
4. Add the following VBA code to the UserForm module:

Code:
Option Explicit

Private Sub UserForm_Initialize()
    'Initialize the UserForm
    'Add code to populate the form elements as needed
End Sub

Private Sub SearchButton_Click()
    'Search for data from Column 1
    Dim searchTerm As String
    searchTerm = TextBox1.Value
   
    'Add code to search for the data in Column 1
   
    'Display buttons with column names
    'Assuming you have Column Names in an array named columnArray
    Dim i As Integer
    For i = LBound(columnArray) To UBound(columnArray)
        Dim newButton As MSForms.CommandButton
        Set newButton = Me.Controls.Add("Forms.CommandButton.1", "Button_" & i, True)
        newButton.Caption = columnArray(i)
        newButton.Left = 10
        newButton.Top = 30 + (i * 20)
        newButton.Width = 100
        newButton.Height = 20
        newButton.Tag = i
        AddHandler newButton.Click, AddressOf Button_Click
    Next i
End Sub

Private Sub Button_Click()
    'Handle button click event
    Dim clickedButton As MSForms.CommandButton
    Set clickedButton = Me.Controls(Application.Caller)
   
    Dim columnIndex As Integer
    columnIndex = clickedButton.Tag
   
    'Input numbers for the entire row based on how many times the button is clicked
    Dim numRows As Integer
    numRows = 'Get the number of times the button is clicked
   
    'Add code to input numbers for the entire row
   
End Sub

Private Sub OKButton_Click()
    'Handle OK button click event
    'Clear the UserForm and reset for another search
    'Add code to clear form elements
End Sub

5. Modify the code as per your specific requirements and data structure. Update the code to search for data in Column 1, populate buttons with column names, input numbers based on button clicks, and handle the OK button click event.
6. Close the VBA editor and save the workbook as a macro-enabled workbook (.xlsm).
7. Insert a button or use a shortcut key to show the UserForm you created.

This code provides a basic framework to achieve the functionalities you mentioned. You can customize and expand upon it to suit your exact needs.
Make an excel form which can do the following:

1. Form can search a data from the column 1
2. After searching the data, buttons with name of columns should appear.
3. As I click each button with column names, it should input numbers for its entire row only based on how many times I clicked the button.
4. After clicking ok, the form should appear again for searching another data.
 
Make an excel form which can do the following:

1. Form can search a data from the column 1
2. After searching the data, buttons with name of columns should appear.
3. As I click each button with column names, it should input numbers for its entire row only based on how many times I clicked the button.
4. After clicking ok, the form should appear again for searching another data.
To create an Excel form with the functionalities you described, you can follow these steps using VBA (Visual Basic for Applications):

1. Create the UserForm:
- Press [Alt] + [F11] to open the Visual Basic for Applications (VBA) editor.
- Go to [Insert] > [UserForm] to create a new UserForm.
- Design your UserForm with elements like text box for search, buttons for columns, and an OK button.

2. Add the following VBA code to the UserForm module:
Code:
vba
   Option Explicit

   Private Sub UserForm_Initialize()
       ' Initialize the UserForm
       ' Add code to populate the form elements as needed
   End Sub

   Private Sub SearchButton_Click()
       ' Search for data from Column 1
       Dim searchTerm As String
       searchTerm = TextBox1.Value
       
       ' Add code to search for the data in Column 1
       
       ' Display buttons with column names
       ' Assuming you have Column Names in an array named columnArray
       Dim i As Integer
       For i = LBound(columnArray) To UBound(columnArray)
           Dim newButton As MSForms.CommandButton
           Set newButton = Me.Controls.Add("Forms.CommandButton.1", "Button_" & i, True)
           newButton.Caption = columnArray(i)
           newButton.Left = 10
           newButton.Top = 30 + (i * 20)
           newButton.Width = 100
           newButton.Height = 20
           newButton.Tag = i
           AddHandler newButton.Click, AddressOf Button_Click
       Next i
   End Sub

   Private Sub Button_Click()
       ' Handle button click event
       Dim clickedButton As MSForms.CommandButton
       Set clickedButton = Me.Controls(Application.Caller)
       
       Dim columnIndex As Integer
       columnIndex = clickedButton.Tag
       
       ' Input numbers for the entire row based on how many times the button is clicked
       Dim numRows As Integer
       numRows = ' Get the number of times the button is clicked
       
       ' Add code to input numbers for the entire row
   End Sub

   Private Sub OKButton_Click()
       ' Handle OK button click event
       ' Clear the UserForm and reset for another search
       ' Add code to clear form elements
   End Sub

3. Customize and Extend:
- Modify the code to suit your specific needs. Update the search functionality, input numbers based on button clicks, and clear the form for the next search.

4. Save and Test:
- Close the VBA editor and save the Excel workbook as a macro-enabled file (.xlsm).
- Insert a button or create a shortcut key to show the UserForm you created.

This code provides a foundation to build the form with the desired functionalities. You can customize and expand upon it to meet your exact requirements. Let me know if you need further assistance or clarification.
 
To create an Excel form with the functionalities you described, you can follow these steps using VBA (Visual Basic for Applications):

1. Create the UserForm:
- Press [Alt] + [F11] to open the Visual Basic for Applications (VBA) editor.
- Go to [Insert] > [UserForm] to create a new UserForm.
- Design your UserForm with elements like text box for search, buttons for columns, and an OK button.

2. Add the following VBA code to the UserForm module:
Code:
vba
   Option Explicit

   Private Sub UserForm_Initialize()
       ' Initialize the UserForm
       ' Add code to populate the form elements as needed
   End Sub

   Private Sub SearchButton_Click()
       ' Search for data from Column 1
       Dim searchTerm As String
       searchTerm = TextBox1.Value
      
       ' Add code to search for the data in Column 1
      
       ' Display buttons with column names
       ' Assuming you have Column Names in an array named columnArray
       Dim i As Integer
       For i = LBound(columnArray) To UBound(columnArray)
           Dim newButton As MSForms.CommandButton
           Set newButton = Me.Controls.Add("Forms.CommandButton.1", "Button_" & i, True)
           newButton.Caption = columnArray(i)
           newButton.Left = 10
           newButton.Top = 30 + (i * 20)
           newButton.Width = 100
           newButton.Height = 20
           newButton.Tag = i
           AddHandler newButton.Click, AddressOf Button_Click
       Next i
   End Sub

   Private Sub Button_Click()
       ' Handle button click event
       Dim clickedButton As MSForms.CommandButton
       Set clickedButton = Me.Controls(Application.Caller)
      
       Dim columnIndex As Integer
       columnIndex = clickedButton.Tag
      
       ' Input numbers for the entire row based on how many times the button is clicked
       Dim numRows As Integer
       numRows = ' Get the number of times the button is clicked
      
       ' Add code to input numbers for the entire row
   End Sub

   Private Sub OKButton_Click()
       ' Handle OK button click event
       ' Clear the UserForm and reset for another search
       ' Add code to clear form elements
   End Sub

3. Customize and Extend:
- Modify the code to suit your specific needs. Update the search functionality, input numbers based on button clicks, and clear the form for the next search.

4. Save and Test:
- Close the VBA editor and save the Excel workbook as a macro-enabled file (.xlsm).
- Insert a button or create a shortcut key to show the UserForm you created.

This code provides a foundation to build the form with the desired functionalities. You can customize and expand upon it to meet your exact requirements. Let me know if you need further assistance or clarification.
Make an excel form that can search a data from column 1. After searching, button with column names should appear and can input numbers on a row based on how many times I clicked it.
 
Make an excel form that can search a data from column 1. After searching, button with column names should appear and can input numbers on a row based on how many times I clicked it.
To create an Excel form with the functionalities you described, you can follow these steps using VBA (Visual Basic for Applications):

1. Create the UserForm:
- Press [Alt] + [F11] to open the Visual Basic for Applications (VBA) editor.
- Go to [Insert] > [UserForm] to create a new UserForm.
- Design your UserForm with elements like a text box for search, buttons for columns, and an OK button.

2. Add the following VBA code to the UserForm module:
Code:
vba
   Option Explicit

   Private Sub UserForm_Initialize()
       ' Initialize the UserForm
       ' Add code to populate the form elements as needed
   End Sub

   Private Sub SearchButton_Click()
       ' Search for data from Column 1
       Dim searchTerm As String
       searchTerm = TextBox1.Value
      
       ' Add code to search for the data in Column 1
      
       ' Display buttons with column names
       ' Assuming you have Column Names in an array named columnArray
       Dim i As Integer
       For i = LBound(columnArray) To UBound(columnArray)
           Dim newButton As MSForms.CommandButton
           Set newButton = Me.Controls.Add("Forms.CommandButton.1", "Button_" & i, True)
           newButton.Caption = columnArray(i)
           newButton.Left = 10
           newButton.Top = 30 + (i * 20)
           newButton.Width = 100
           newButton.Height = 20
           newButton.Tag = i
           AddHandler newButton.Click, AddressOf Button_Click
       Next i
   End Sub

   Private Sub Button_Click()
       ' Handle button click event
       Dim clickedButton As MSForms.CommandButton
       Set clickedButton = Me.Controls(Application.Caller)
      
       Dim columnIndex As Integer
       columnIndex = clickedButton.Tag
      
       ' Input numbers for the entire row based on how many times the button is clicked
       Dim numRows As Integer
       numRows = ' Get the number of times the button is clicked
      
       ' Add code to input numbers for the entire row
   End Sub

3. Customize and Extend:
- Modify the code to suit your specific needs. Update the search functionality, input numbers based on the button clicks, and clear the form for the next search.

4. Save and Test:
- Close the VBA editor and save the Excel workbook as a macro-enabled file (.xlsm).
- Insert a button or create a shortcut key to show the UserForm you created.

This code provides a foundation to build the form with the desired functionalities. You can customize and expand upon it to meet your exact requirements. Let me know if you need further assistance or clarification.
 
To create an Excel form with the functionalities you described, you can follow these steps using VBA (Visual Basic for Applications):

1. Create the UserForm:
- Press [Alt] + [F11] to open the Visual Basic for Applications (VBA) editor.
- Go to [Insert] > [UserForm] to create a new UserForm.
- Design your UserForm with elements like a text box for search, buttons for columns, and an OK button.

2. Add the following VBA code to the UserForm module:
Code:
vba
   Option Explicit

   Private Sub UserForm_Initialize()
       ' Initialize the UserForm
       ' Add code to populate the form elements as needed
   End Sub

   Private Sub SearchButton_Click()
       ' Search for data from Column 1
       Dim searchTerm As String
       searchTerm = TextBox1.Value
     
       ' Add code to search for the data in Column 1
     
       ' Display buttons with column names
       ' Assuming you have Column Names in an array named columnArray
       Dim i As Integer
       For i = LBound(columnArray) To UBound(columnArray)
           Dim newButton As MSForms.CommandButton
           Set newButton = Me.Controls.Add("Forms.CommandButton.1", "Button_" & i, True)
           newButton.Caption = columnArray(i)
           newButton.Left = 10
           newButton.Top = 30 + (i * 20)
           newButton.Width = 100
           newButton.Height = 20
           newButton.Tag = i
           AddHandler newButton.Click, AddressOf Button_Click
       Next i
   End Sub

   Private Sub Button_Click()
       ' Handle button click event
       Dim clickedButton As MSForms.CommandButton
       Set clickedButton = Me.Controls(Application.Caller)
     
       Dim columnIndex As Integer
       columnIndex = clickedButton.Tag
     
       ' Input numbers for the entire row based on how many times the button is clicked
       Dim numRows As Integer
       numRows = ' Get the number of times the button is clicked
     
       ' Add code to input numbers for the entire row
   End Sub

3. Customize and Extend:
- Modify the code to suit your specific needs. Update the search functionality, input numbers based on the button clicks, and clear the form for the next search.

4. Save and Test:
- Close the VBA editor and save the Excel workbook as a macro-enabled file (.xlsm).
- Insert a button or create a shortcut key to show the UserForm you created.

This code provides a foundation to build the form with the desired functionalities. You can customize and expand upon it to meet your exact requirements. Let me know if you need further assistance or clarification.
Create a buttom which allows me to search for a data in column 1. After searching, buttons with each column names should appear and as I click it, it will input numbers on the entire row based on how many times I clicked it.
 
Create a buttom which allows me to search for a data in column 1. After searching, buttons with each column names should appear and as I click it, it will input numbers on the entire row based on how many times I clicked it.
To create an Excel form with the functionalities you described, you can follow these steps using VBA (Visual Basic for Applications):

1. Create the UserForm:
- Press [Alt] + [F11] to open the Visual Basic for Applications (VBA) editor.
- Go to [Insert] > [UserForm] to create a new UserForm.
- Design your UserForm with elements like a text box for search, buttons for columns, and an OK button.

2. Add the following VBA code to the UserForm module:
Code:
vba
   Option Explicit

   Private Sub UserForm_Initialize()
       ' Initialize the UserForm
       ' Add code to populate the form elements as needed
   End Sub

   Private Sub SearchButton_Click()
       ' Search for data from Column 1
       Dim searchTerm As String
       searchTerm = TextBox1.Value
      
       ' Add code to search for the data in Column 1
      
       ' Display buttons with column names
       ' Assuming you have Column Names in an array named columnArray
       Dim i As Integer
       For i = LBound(columnArray) To UBound(columnArray)
           Dim newButton As MSForms.CommandButton
           Set newButton = Me.Controls.Add("Forms.CommandButton.1", "Button_" & i, True)
           newButton.Caption = columnArray(i)
           newButton.Left = 10
           newButton.Top = 30 + (i * 20)
           newButton.Width = 100
           newButton.Height = 20
           newButton.Tag = i
           AddHandler newButton.Click, AddressOf Button_Click
       Next i
   End Sub

   Private Sub Button_Click()
       ' Handle button click event
       Dim clickedButton As MSForms.CommandButton
       Set clickedButton = Me.Controls(Application.Caller)
     
       Dim columnIndex As Integer
       columnIndex = clickedButton.Tag
     
       ' Input numbers for the entire row based on how many times the button is clicked
       Dim numRows As Integer
       numRows = ' Get the number of times the button is clicked
     
       ' Add code to input numbers for the entire row
   End Sub

3. Customize and Extend:
- Modify the code to suit your specific needs. Update the search functionality, input numbers based on the button clicks, and clear the form for the next search.

4. Save and Test:
- Close the VBA editor and save the Excel workbook as a macro-enabled file (.xlsm).
- Insert a button or create a shortcut key to show the UserForm you created.

This code provides a foundation to build the form with the desired functionalities. You can customize and expand upon it to meet your exact requirements. Let me know if you need further assistance or clarification.
 

About this Thread

  • 8
    Replies
  • 481
    Views
  • 2
    Participants
Last reply from:
Unknown user

Trending Topics

Online now

Members online
1,242
Guests online
1,439
Total visitors
2,681

Forum statistics

Threads
2,268,793
Posts
28,924,104
Members
1,243,055
Latest member
surfsaya20
Back
Top