Hello everyone. I have a sheet that populates a portion of another sheet based on criteria in one of the columns. The code I am using is based (almost exactly) off of a bit another user posted on here and it has worked fantastically. That is, except for when it comes to copying the formulas present in the rows being copied. It copies the values, but not the formulas. The reference locations are the same on both sheets, but the values in some of the reference cells change so it leads to incorrect numbers. Below is the code. I tried modifying it myself in various ways but have failed pretty universally. Any help is greatly appreciated!
Option Explicit
Private Sub Worksheet_Activate()
Dim LR As Long
Worksheets("SheetC").Range("A26:z100").Clear 'clear existing data
With Sheets("SheetI")
.AutoFilterMode = False 'remove any prior filtering
.Rows(25).AutoFilter 'activate autofilter
.Rows(25).AutoFilter 3, "=1" 'filter column C for 1
LR = .Range("B" & .Rows.Count).End(xlUp).Row 'is any data visible?
If LR > 1 Then
.Range("A26:H" & LR).Copy Range("A26") 'copy any data visible to report
Else
Range("A26") = "no data found" 'if none, give that message
End If
.AutoFilterMode = False 'turn off autofilter
End With
End Sub
Edit: Formulars are found in Column H rows 26 - 44 (rows differ based on autofilter)
Bookmarks