Solved

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

Posted on 2016-08-29
7
37 Views
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
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

Open in new window

0
Comment
Question by:Omar Hernandez
  • 4
  • 3
7 Comments
 
LVL 43

Expert Comment

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

Author Comment

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

Author Comment

by:Omar Hernandez
ID: 41775393
Thanks for your fast response, please see attachment underneath this comment
TO-DO-8-29.xlsm
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

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

Open in new window

0
 

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.
0
 
LVL 43

Accepted Solution

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

Author Closing Comment

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

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now