Forum

vba find date and e...
 
Notifications
Clear all

vba find date and enter UserForm text box

2 Posts
2 Users
0 Reactions
86 Views
(@martinrusten)
Posts: 1
New Member
Topic starter
 

vba find date and enter UserForm text box

 

hello, i have a list where vba need to find the date in sheets and also the machine name then paste the userform text box

userform works but it do not paste any info.

i have played around with this a few days and can not figure how to make it work, i really hope someone here can help with this

thank you

 

Edit:

big thanks to Christofer Weber that made this work
at https://superuser.com/questions/1414850/vba-find-date-and-enter-userform-text-box/1414900#1414900

and big thanks to 大灰狼1976 that made all the work
at http://www.vbaexpress.com/forum/showthread.php?64790-vba-find-text-paste-text-in-message-box-next-cell

if someone need to download the complete file, the working file is located on the vbaexpress forum

thank you all

 
Posted : 18/03/2019 1:56 pm
(@catalinb)
Posts: 1937
Member Admin
 

Hi Martin,

If you want to paste data rom textboxes into the correct sheet cells, the code from your CommandButton1 should look like this:

With Sheets(Mon)
    Set rng = .Rows(3).Find(Dat, lookat:=xlWhole)
    If Not rng Is Nothing Then
        Set mch = .Columns(1).Find(mch1, lookat:=xlWhole)
        If Not mch Is Nothing Then
            .Cells(mch.Row, rng.Column + 1) = TextBox1
            .Cells(mch.Row, rng.Column + 2) = Format(TextBox2, "d/m/yy")
            .Cells(mch.Row, rng.Column + 3) = TextBox3
        Else
            MsgBox "can not find machine"
        End If
    Else
           MsgBox "can not find date"
    End If
End With

 
Posted : 20/03/2019 6:42 am
Share: