Hi.. the code below are working fine except that I need to have it in values not in formula. can anyone help..Thanks
hereis my code:
Private Sub okbut_Click()
Dim startdate As Date, enddate As Date
Dim rng As Range, destRow As Long
Dim shtSrc As Worksheet, shtDest As Worksheet
Dim c As Range
Set shtSrc = Sheets("SUMMARY")
Set shtDest = Sheets("Transmittal")
destRow = 20 'start copying to this row
startdate = TRANSMIT.transfrom.Value
enddate = TRANSMIT.transto.Value
'don't scan the entire column...
Set rng = Application.Intersect(shtSrc.Range("D:D"), shtSrc.UsedRange)
For Each c In rng.Cells
If c.Value >= startdate And c.Value <= enddate Then
c.Offset(0, 0).Resize(1, 1).Copy shtDest.Cells(destRow, 1)
c.Offset(0, 1).Resize(1, 1).Copy shtDest.Cells(destRow, 2)
c.Offset(0, -2).Resize(1, 1).Copy shtDest.Cells(destRow, 3)
c.Offset(0, -1).Resize(1, 1).Copy shtDest.Cells(destRow, 4)
c.Offset(0, 4).Resize(1, 1).Copy shtDest.Cells(destRow, 5)
c.Offset(0, 11).Resize(1, 1).Copy shtDest.Cells(destRow, 6)
destRow = destRow + 1
End If
Next
End Sub
hereis my code:
Private Sub okbut_Click()
Dim startdate As Date, enddate As Date
Dim rng As Range, destRow As Long
Dim shtSrc As Worksheet, shtDest As Worksheet
Dim c As Range
Set shtSrc = Sheets("SUMMARY")
Set shtDest = Sheets("Transmittal")
destRow = 20 'start copying to this row
startdate = TRANSMIT.transfrom.Value
enddate = TRANSMIT.transto.Value
'don't scan the entire column...
Set rng = Application.Intersect(shtSrc.Range("D:D"), shtSrc.UsedRange)
For Each c In rng.Cells
If c.Value >= startdate And c.Value <= enddate Then
c.Offset(0, 0).Resize(1, 1).Copy shtDest.Cells(destRow, 1)
c.Offset(0, 1).Resize(1, 1).Copy shtDest.Cells(destRow, 2)
c.Offset(0, -2).Resize(1, 1).Copy shtDest.Cells(destRow, 3)
c.Offset(0, -1).Resize(1, 1).Copy shtDest.Cells(destRow, 4)
c.Offset(0, 4).Resize(1, 1).Copy shtDest.Cells(destRow, 5)
c.Offset(0, 11).Resize(1, 1).Copy shtDest.Cells(destRow, 6)
destRow = destRow + 1
End If
Next
End Sub