Results 1 to 3 of 3

Code are not working

Threaded View

abjac Code are not working 03-14-2013, 09:08 AM
Norie Re: Code are not working 03-14-2013, 09:15 AM
abjac Re: Code are not working 03-14-2013, 10:33 AM
  1. #1
    Forum Contributor
    Join Date
    07-28-2012
    Location
    madrid
    MS-Off Ver
    Excel 2010 at work excel 2016
    Posts
    1,102

    Code are not working

    HI Could some have a look at below code. It has an error i i cant figure out where it is.
    I need to use to search in sheet3 and copy the result to sheet2 after the startdate and enddate i put in.

    Please have a look thanks.

    You can also look at the sample below.

    Thanks

    Abjac


    Dim sh As Worksheet
    
    Dim LR As Long
    
    Sub SetWorksheet1()
    Sheets(3).Activate
    Set sh = ThisWorkbook.Sheets(2)
        LR = sh.Cells(Rows.Count, "A").End(xlUp).Row
        
        Call searchdate1(sh, LR)
        
        
    End Sub
    
    
    Sub searchdate1()
    
    Dim k As Long, j As Long
    Dim myWord As String
    Dim myRng As Range
    linestart:
    sdate = InputBox("Input Startdate ")
    enddate = InputBox("Input Enddate ")
    If sdate = "" Or enddate = "" Then Exit Sub
    On Error Resume Next
    Nsdate = CDate(sdate)
    Nenddate = CDate(enddate)
    On Error GoTo 0
    drow = 2
    For k = 4 To Cells(Rows.Count, "L").End(xlUp).Row
      fdate = Range("L" & k)
      If fdate >= Nsdate And fdate <= Nenddate Then
    
        sh.Rows(drow) = Rows(k).Value
        drow = drow + 1
        ffound = ffound + 1
      End If
    Next k
    If ffound = 0 Then
      MsgBox "Not found, Try again"
      GoTo linestart
      
    End If
    
    
    
    
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

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