title: stuck with my vba code to filter find data based on date
body: <p>This works fine when I am using date, but If i am trying to used input box for entering my desired date to get data it doesn't work... Any Suggestions??</p>
  
  <pre><code>sub datewise()
  Dim lastrow As Long, erow As Long, i As Integer, lastcolumn As Long
  Dim today, tomorrow As String
  Dim k As Integer, j As Integer, s As Integer
  
  
  today = InputBox(Prompt:="Please enter the date in d/m/yyyy format", Title:="Shift Date", Default:="7/6/2018")
  
  'today = Date
  'tomorrow = today + 1
  
  lastrow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
   j = 3
   Do While j &lt; 40
   If today = Sheet1.Cells(2, j) Then
   Sheet1.Cells(2, j).Copy
   Sheet1.Paste Worksheets("Sheet2").Cells(2, 2)
   Sheet1.Paste Worksheets("Sheet2").Cells(2, 4)
   Sheet1.Paste Worksheets("Sheet2").Cells(2, 6)
   k = j
   Exit Do
   End If
   j = j + 1
   Loop
  
   '------1800 Shift------
  
  
  i = 3
  erow = 4
  Do While i &lt;= lastrow
  
  If Sheet1.Cells(i, k).Value = 18 Then
  Sheet1.Cells(i, 1).Copy
  Sheet1.Paste Worksheets("Sheet2").Cells(erow, 1)
  
  Sheet1.Cells(i, 2).Copy
  Sheet1.Paste Worksheets("Sheet2").Cells(erow, 2)
  
  erow = erow + 1
  End If
  i = i + 1
  Loop
  
  
  
  Application.CutCopyMode = False
  Sheet2.Columns().AutoFit
  Range("A1").Select
  End Sub
  </code></pre>
  
  <p>I need to use my mastersheet date and filter it based on the date I need, I was thinking maybe I need to use auto filter option but the date data is in a row so filter also can't be used. This code works fine if I use date variable</p>