• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Adding subtask that shows in userform and then creates in new row

kalua1231

Member
Hello guys, i have created this userform and got it to work up to the point of the information text in the textbox send to a new row.

What i want in addition is that when i click on a row and then click on the button called add_subtask
***Have that row of column (D and E) shown on the userform.
***When clicked on the userform option button (ADD SUBTASK) have all the information on the userform sent to a new row. Demonstration is on attachment and code is underneath this line, i would appreciate it a mil Chandoo Ninjas and thanks for your time.
Code:
Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("GENERAL")

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row

'check for a Name number
If Trim(Me.textbox_name.Value) = "" Then
Me.textbox_name.SetFocus
MsgBox "Please complete the form"
Exit Sub
End If

'copy the data to the database
ws.Cells(iRow, 3).Value = Me.textbox_name.Value


MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
Me.textbox_name.Value = ""
Me.textbox_name.SetFocus
End Sub

Private Sub CommandButton2_Click()
Unload Me
End Sub
 

Attachments

  • ADDING SUBS.png
    ADDING SUBS.png
    179.3 KB · Views: 5
  • ADDING SUBS 2.png
    ADDING SUBS 2.png
    189.2 KB · Views: 7
  • ADDING SUBS 3.png
    ADDING SUBS 3.png
    194.7 KB · Views: 7
When looking for the solution for this problem it is this actual code that i ma using to make it possible.

Code:
Private Sub CommandButton1_Click()
Dim iRow As Long
Dim ws As Worksheet
Set ws = Worksheets("GENERAL")

If ActiveCell.EntireRow.Cells(1, 5) <> "" Then Label3.Caption = ActiveCell.EntireRow.Cells(1, 5)
    If ActiveCell.EntireRow.Cells(1, 4) <> "" Then Label4.Caption = ActiveCell.EntireRow.Cells(1, 4)

'find first empty row in database
iRow = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row

'check for a Name number
If Trim(Me.textbox_name.Value) = "" Then
Me.textbox_name.SetFocus
MsgBox "Please complete the form"
Exit Sub
End If

'copy the data to the database
        ws.Cells(iRow, 3).Value = Me.textbox_name.Value
        ws.Cells(iRow, 4).Value = Me.Label4.Caption
        ws.Cells(iRow, 5).Value = Me.Label3.Caption

MsgBox "Data added", vbOKOnly + vbInformation, "Data Added"
'clear the data
Me.textbox_name.Value = ""
Me.textbox_name.SetFocus
End Sub

Private Sub CommandButton2_Click()
Unload Me
End Sub
 
again thanks chandoo for your recent help, this forum has help me big time why not help other who is trying to find similar solution for these type of problem:DD
 
Back
Top