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

Posted on 2016-08-29
Last Modified: 2016-08-29
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 Experts Exchange users and thanks for your time.

Demonstration 1Demonstration 2Demonstration 3
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
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 = ""
End Sub

Private Sub CommandButton2_Click()
Unload Me
End Sub

Open in new window

Question by:Omar Hernandez
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41775141
How about uploading an excel file?

Author Comment

by:Omar Hernandez
ID: 41775392
please see attachment underneath this comment

Author Comment

by:Omar Hernandez
ID: 41775393
Thanks for your fast response, please see attachment underneath this comment
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 41775774
Add this sub to the userform module below the CommandButton1_Click() sub

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

Open in new window

and in the CommandButton1_Click() sub below the line
ws.Cells(iRow, 3).Value = Me.textbox_name.Value

Open in new window

ws.Cells(iRow, 4).Value = Me.Label4.Caption
ws.Cells(iRow, 5).Value = Me.Label3.Caption

Open in new window


Author Comment

by:Omar Hernandez
ID: 41775781
thanks saqib It works any chance it can display the information retrieved from column d and e, when pressed on the (add subtask) button before hitting enter.
LVL 43

Accepted Solution

Saqib Husain, Syed earned 500 total points
ID: 41775800
It should display as soon as the userform is activated.

Author Closing Comment

by:Omar Hernandez
ID: 41775803
Thanks a mil Saqib Husain for your help

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel shared spreadsheet 12 38
Excel - merge column values 3 26
need count all combination 31 32
Disable auto refresh in a sheet 2 13
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question