Results 1 to 8 of 8

Userform is not working.

Threaded View

  1. #1
    Registered User
    Join Date
    05-24-2019
    Location
    Sweden
    MS-Off Ver
    2013
    Posts
    13

    Angry Userform is not working.

    Hi!
    Im trying to extract specific data between two dates into another sheet with userform. But I dont know what im doing wrong..
    all help is welcome.


    error.JPG



     Private Sub CommandButton1_Click()
    
    Dim lrow As Long, i As Long, x As Date, y As Date, erow As Long
    
    x = TextBox1
    y = TextBox2
    
    'Find the Last Row (data filled row) of Sheet1
    lrow = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
    
    'start counting from row 2 to last row
    For i = 2 To lrow
    ' here the date balue is converted as numeric value by multiplying with number 1
    If Cells(i, 1) * 1 >= x * 1 Then
    If Cells(i, 1) * 1 >= y * 1 Then
    
    ' here i,3(the column number where Artikel found
    If Trim(Cells(i, 3)) = Trim(TextBox3.Text) Then
    
    'if above conditions matched then select the matched range or entire row
    Sheet1.Range(Cells(i, 1), Cells(i, 4)).Select
    'to copy the selected row
    Selection.Copy
    'to make sheet2 active where we want to paste the selected row
    Sheets("Sheet2").Activate
    'to find the empty row from where the copide row of sheet1 to be pasted in sheet2
    erow = Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
    'to activate or select the empty row of sheet2
    ActiveSheet.Cells(erow, 1).Select
    'to paste the copied row
    ActiveSheet.Paste
    'to deselect the copy and selected mode
    Application.CutCopyMode = False
    'for above the if we need 3 end if to close if conditions
    End If
    End If
    End If
    'finally to activate sheet1 for searching the mached data
    Sheets("Sheet1").Activate
    'now to continue for look until above matched found
    Next i
    End Sub
    Attached Files Attached Files
    Last edited by jhakans; 05-27-2019 at 11:30 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] progress bar userform inside userform not working
    By kevinu in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-22-2018, 05:41 PM
  2. userform not working properly
    By shiva_raj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-10-2017, 04:53 PM
  3. Why Isn't My Userform Working?
    By drsadistic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-27-2014, 11:18 PM
  4. Printing a userform - Not working
    By excelenergy in forum Excel General
    Replies: 3
    Last Post: 03-13-2014, 03:09 PM
  5. [SOLVED] Gradually Fade Userform Into View [Userform Fade Out Working Already]
    By nadstradamus in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-05-2013, 04:12 AM
  6. Alt+Tab not working when an userform is opened
    By sivdin in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-28-2009, 06:34 AM
  7. [SOLVED] Working with Cells on Userform
    By Jeff Ingraham in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-20-2006, 01:15 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1