brkkrkmz112
New Member
- Joined
- Oct 24, 2016
- Messages
- 43
Hi guys,
Im having trouble with a userform which contain textbox and combobox and I asked my question in a couple of part.
Firstly, ım trying to do when I activate the userform , it is supposed to ask me TimeSheet Num. That is so easy but the thing that ı get stuck on getting the TimeSheet num variable into Combobox code when the userform sub ends.
Second one ,
If the situation above seems like hard or impossible. With the code below, I can find the answer somehow . But every time I click the combobox button . It asks me the Timesheet num again and again. Is there a way to get rid of that
Actually if I can transfer the asking TimeSheetnum into Userform_initialize code , it would be perfect . Bu as ı said ı dont know how to transfer the value of a variable from a sub to another.
Thank you very much in advance.
Im having trouble with a userform which contain textbox and combobox and I asked my question in a couple of part.
Firstly, ım trying to do when I activate the userform , it is supposed to ask me TimeSheet Num. That is so easy but the thing that ı get stuck on getting the TimeSheet num variable into Combobox code when the userform sub ends.
Second one ,
If the situation above seems like hard or impossible. With the code below, I can find the answer somehow . But every time I click the combobox button . It asks me the Timesheet num again and again. Is there a way to get rid of that
Actually if I can transfer the asking TimeSheetnum into Userform_initialize code , it would be perfect . Bu as ı said ı dont know how to transfer the value of a variable from a sub to another.
Thank you very much in advance.
Code:
Option Explicit
Private Sub CommandButton1_Click()
Dim kolon_no As Integer
Dim aralık As Range, k As Integer
Dim kolon As Range, columnnum As Integer
kolon_no = 0
Call setcolon(kolon_no)
Set aralık = ActiveSheet.Range("e3:aaa3")
Set kolon = aralık.Find(kolon_no)
columnnum = kolon.Column
For k = 7 To 28
Cells(k, columnnum) = Cells(k, columnnum) + controls("TextBox" & (k - 6)).Value
Next k
End Sub
Private Sub UserForm_Initialize()
Dim i As Integer
Dim k As Integer, m As Integer
For i = 7 To 28
m = i - 6
Me.controls("Label" & m).Caption = ActiveSheet.Range("A" & i).Value
Next i
End Sub
Function setcolon(z As Integer)
z = InputBox("TimeSheet Num", "TimeSheet Num ")
End Function
Last edited: