Hi 00Able
Took a look at the code for Public Sub PullData()
Changes are underlined (see lines 310, 500 & 670)
Public Sub PullData()
Dim fRng As Range
Dim LR As Long
10 Application.ScreenUpdating = False
20 Flag = True
30 Flag1 = True
40 With Sheet1
50 If Sheet2.TextBox1.Value = "" Or Sheet2.TextBox2.Value = "" Then
60 MsgBox "Enter a start and end date"
70 Sheet2.TextBox1.Value = ""
80 Sheet2.TextBox2.Value = ""
90 Application.ScreenUpdating = True
100 Exit Sub
110 End If
120 If DateValue(Sheet2.TextBox1.Value) > DateValue(Sheet2.TextBox2.Value) Then
130 MsgBox "End Date must be greater than or equal to Start Date"
140 Sheet2.TextBox1.Value = ""
150 Sheet2.TextBox2.Value = ""
160 Application.ScreenUpdating = True
170 Exit Sub
180 End If
190 .AutoFilterMode = False
200 .Columns("A:A").AutoFilter Field:=1, Criteria1:=">=" & Sheet2.TextBox1.Value, Operator:=xlAnd _
, Criteria2:="<=" & Sheet2.TextBox2.Value
210 With Sheet1.AutoFilter.Range
220 If .Columns(1).SpecialCells(xlCellTypeVisible).Count - 1 = 0 Then
230 Sheet1.AutoFilterMode = False
240 Flag = False
250 GoTo NextSheet
260 End If
270 Set fRng = .Offset(1, 0).Resize(.Rows.Count - 1, 11) _
.SpecialCells(xlCellTypeVisible)
280 End With
290 LR = Sheet2.Range("A" & Rows.Count).End(xlUp).Row + 1
300 fRng.Copy
310 Worksheets("FRONT PAGE").Range("A" & LR).PasteSpecial Paste:=xlPasteValues
320 Application.CutCopyMode = False
330 .AutoFilterMode = False
340 Flag = True
350 End With
NextSheet:
360 With Sheet4
370 .AutoFilterMode = False
380 .Columns("A:A").AutoFilter Field:=1, Criteria1:=">=" & Sheet2.TextBox1.Value, Operator:=xlAnd _
, Criteria2:="<=" & Sheet2.TextBox2.Value
390 With Sheet4.AutoFilter.Range
400 If Not .Columns(1).SpecialCells(xlCellTypeVisible).Count - 1 = 0 Then
410 Set fRng = .Offset(1, 0).Resize(.Rows.Count - 1, 11) _
.SpecialCells(xlCellTypeVisible)
420 Flag1 = True
430 Else: Flag1 = False
440 Sheet4.AutoFilterMode = False
450 GoTo SortRecords
460 End If
470 End With
480 LR = Sheet2.Range("A" & Rows.Count).End(xlUp).Row + 1
490 fRng.Copy
500 Worksheets("FRONT PAGE").Range("A" & LR).PasteSpecial Paste:=xlPasteValues
510 Application.CutCopyMode = False
520 .AutoFilterMode = False
530 Flag = True
540 End With
SortRecords:
550 With Sheet2
560 If Flag = True Or Flag1 = True Then
570 LR = .Range("A" & .Rows.Count).End(xlUp).Row
580 Range("A2:K" & LR).Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlYes, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
590 Else
600 MsgBox "No Records Found"
610 Sheet2.TextBox1.Value = ""
620 Sheet2.TextBox2.Value = ""
630 End If
640 End With
650 Flag = True
660 Flag1 = True
670 Columns("A:A").NumberFormat = "m/d/yyyy;@"
680 Application.ScreenUpdating = True
End Sub
The code will pull ACTUAL VALUES into Front Page rather than cell references. Let me know how things progress.
John
Bookmarks