Good morning,
I am having a problem with some code I am trying to do. I am new to coding and would love some help. I have multiple sheets that I need data to be pulled from to a summary sheet when the case is over 90 days old, which is column "G", all the sheets are the same, columns A-I, with headers on rows 1-5. I also want it to run automatically when the file is opened, but clear the summary sheet of the rows from last open, so that the data is not duplicated. In addition I want it to paste values only and not formulas. It works to run automatically, but it seems that the pasting of formulas is causing it to paste the wrong rows, which is why I only need values. What I have so far is below. Any help would be greatly appreciated.
Private Sub Workbook_Open()
Dim wsSum As Worksheet: Set wsSum = Sheets("Summary-Cases over 90 Days")
Dim ws As Worksheet
Dim rCell As Range
For Each ws In Worksheets
If ws.Name <> wsSum.Name And ws.Name <> "DropDowns" Then
For Each rCell In ws.Range("G5:G" & ws.Range("G" & Rows.Count).End(xlUp).Row)
If rCell.Value <> "" And IsNumeric(rCell.Value) Then
If rCell.Value > 89 Then
rCell.EntireRow.Copy Destination:=wsSum.Range("G" & Rows.Count).End(xlUp).Offset(1, -6)
End If
End If
Next rCell
End If
Next ws
End Sub
Thanks
I am having a problem with some code I am trying to do. I am new to coding and would love some help. I have multiple sheets that I need data to be pulled from to a summary sheet when the case is over 90 days old, which is column "G", all the sheets are the same, columns A-I, with headers on rows 1-5. I also want it to run automatically when the file is opened, but clear the summary sheet of the rows from last open, so that the data is not duplicated. In addition I want it to paste values only and not formulas. It works to run automatically, but it seems that the pasting of formulas is causing it to paste the wrong rows, which is why I only need values. What I have so far is below. Any help would be greatly appreciated.
Private Sub Workbook_Open()
Dim wsSum As Worksheet: Set wsSum = Sheets("Summary-Cases over 90 Days")
Dim ws As Worksheet
Dim rCell As Range
For Each ws In Worksheets
If ws.Name <> wsSum.Name And ws.Name <> "DropDowns" Then
For Each rCell In ws.Range("G5:G" & ws.Range("G" & Rows.Count).End(xlUp).Row)
If rCell.Value <> "" And IsNumeric(rCell.Value) Then
If rCell.Value > 89 Then
rCell.EntireRow.Copy Destination:=wsSum.Range("G" & Rows.Count).End(xlUp).Offset(1, -6)
End If
End If
Next rCell
End If
Next ws
End Sub
Thanks