DT909
12-09-2017, 03:47 AM
OK guys, next question :)
When I fill my userform and click on create button, it put all the information in the selected cells. This works quite well.
I would like to add also a button, dynamically, in the last cell of each row.
Then the user can add a hyperlink to this button, to open another excel file. Each link will be different, so this has to be done manually. But I just want to add a button in 1 cell of each row. The caption could just be "Link" and when the user right click on it, he must be able to add the hyperlink.
I hope that my question is clear :)
Thanks in advance for your help
For info : the column number is 12
And the current code is following :
Private Sub CreateBtn_Click()
Dim emptyRow As Long
Dim ligne As Integer
'Determine emptyRow
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
If MsgBox("Confirm creation of this EPC ?", vbYesNo, "confirmation") = vbYes Then
Worksheets("sheet1").Select
ligne = Sheets("sheet1").Range("A456541").End(xlUp).Row + 1
Cells(emptyRow, 1).Value = Date1.Value
Cells(emptyRow, 2).Value = TextBox5.Value
Cells(emptyRow, 3).Value = EPCNum
Cells(emptyRow, 4).Value = PCList.Value
Cells(emptyRow, 5).Value = TextBox2.Value
Cells(emptyRow, 6).Value = proFITList.Value
Cells(emptyRow, 7).Value = ProjectText.Value
Cells(emptyRow, 8).Value = ComboBox1.Value
Cells(emptyRow, 9).Value = ComboBox2.Value
Cells(emptyRow, 10).Value = TextBox4.Value
Cells(emptyRow, 11).Value = TextBox3.Value
Cells(emptyRow, 12).Value = ""
Cells(emptyRow, 13).Value = ComboBox3.Value
Cells(emptyRow, 14).Value = CommentText.Value
If ProjectText.Value = "" Or PCList.Value = "" Or proFITList.Value = "" Then
MsgBox ("Please enter information about this project")
End If
Unload EPC
EPC.Show
Else
End If
Call findnextnumber
End Sub
When I fill my userform and click on create button, it put all the information in the selected cells. This works quite well.
I would like to add also a button, dynamically, in the last cell of each row.
Then the user can add a hyperlink to this button, to open another excel file. Each link will be different, so this has to be done manually. But I just want to add a button in 1 cell of each row. The caption could just be "Link" and when the user right click on it, he must be able to add the hyperlink.
I hope that my question is clear :)
Thanks in advance for your help
For info : the column number is 12
And the current code is following :
Private Sub CreateBtn_Click()
Dim emptyRow As Long
Dim ligne As Integer
'Determine emptyRow
emptyRow = WorksheetFunction.CountA(Range("A:A")) + 1
If MsgBox("Confirm creation of this EPC ?", vbYesNo, "confirmation") = vbYes Then
Worksheets("sheet1").Select
ligne = Sheets("sheet1").Range("A456541").End(xlUp).Row + 1
Cells(emptyRow, 1).Value = Date1.Value
Cells(emptyRow, 2).Value = TextBox5.Value
Cells(emptyRow, 3).Value = EPCNum
Cells(emptyRow, 4).Value = PCList.Value
Cells(emptyRow, 5).Value = TextBox2.Value
Cells(emptyRow, 6).Value = proFITList.Value
Cells(emptyRow, 7).Value = ProjectText.Value
Cells(emptyRow, 8).Value = ComboBox1.Value
Cells(emptyRow, 9).Value = ComboBox2.Value
Cells(emptyRow, 10).Value = TextBox4.Value
Cells(emptyRow, 11).Value = TextBox3.Value
Cells(emptyRow, 12).Value = ""
Cells(emptyRow, 13).Value = ComboBox3.Value
Cells(emptyRow, 14).Value = CommentText.Value
If ProjectText.Value = "" Or PCList.Value = "" Or proFITList.Value = "" Then
MsgBox ("Please enter information about this project")
End If
Unload EPC
EPC.Show
Else
End If
Call findnextnumber
End Sub