Been trying to look up VBA code to search a specific column name "Process Total" in "column I" of tab name "AWD List" based on Column D name "POLRES"
Is there a way to find that "Process Total" row in Column I that corresponds to Column B name "POLRES" and then have it open that cell in "Column I" into a new sheet named "POLRES"
I need it to open it up as if i'm double clicking and creating a pivot table (tab example in workbook)
Here is code I'm using:
Sub OpenPolresTotal()
Dim Pfind As Object
Dim Ptotal
Dim TotalSheets As Integer
Dim TestSheetNum As Integer
Dim TestSheetName As String
Dim NewSheet As String
Dim SheetFound As Boolean
With Sheets("AWD List").Columns("D")
Set Pfind = .Find(What:="polres", LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
End With
If Not Pfind Is Nothing Then
''''Part that errors out
Ptotal = Range("I" & Pfind.Row).showdetail = true
Else
MsgBox "not Found"
End If
'check to see if sheet exists
TotalSheets = Sheets.Count
SheetFound = False
For TestSheetNum = 1 To TotalSheets
If Sheets(TestSheetNum).Name = "Polres" Then
SheetFound = True
Exit For
End If
Next
If Not SheetFound Then
Sheets.Add.Name = "Polres"
Sheets("Polres").Cells(1, 1) = Ptotal
End If
End Sub