Results 1 to 2 of 2

Thread: vba find date and enter UserForm text box

  1. #1
    Neophyte martinrusten's Avatar
    Join Date
    Mar 2019
    Posts
    2
    Articles
    0
    Excel Version
    2018

    vba find date and enter UserForm text box



    Register for a FREE account, and/
    or Log in to avoid these ads!

    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

    the code that do not work is here:
    Code:
    Private Sub CommandButton1_Click()
    Dim arr, Dat As Date, Mon$, rng As Range, mch As Range, mch1$, clm&
    arr = Array("Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember")
    Dat = Sheets("Dayplan").Cells(r, 3)
    mch1 = Sheets("Dayplan").Cells(r, 4)
    Mon = arr(Month(Dat) - 1)
    
    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
    TextBox1 = .Cells(mch.Row, rng.Column + 1)
    TextBox2 = Format(.Cells(mch.Row, rng.Column + 2), "d/m/yy")
    TextBox3 = .Cells(mch.Row, rng.Column + 3)
    End If
    MsgBox "can not find machine"
    End If
    MsgBox "can not find date"
    End With
    Me.Hide
    End Sub

    Click image for larger version. 

Name:	1.jpg 
Views:	18 
Size:	98.0 KB 
ID:	8972

    Click image for larger version. 

Name:	2.jpg 
Views:	14 
Size:	105.1 KB 
ID:	8973

    thank you
    Attached Files Attached Files

  2. #2
    Neophyte martinrusten's Avatar
    Join Date
    Mar 2019
    Posts
    2
    Articles
    0
    Excel Version
    2018
    SOLVED!!!!!!





    big thanks to Christofer Weber that made this work
    at https://superuser.com/questions/1414...414900#1414900


    and big thanks to 大灰狼1976 that made all the work
    at http://www.vbaexpress.com/forum/show...-box-next-cell


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


    thank you all

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •