Can anyone explain what is the below code ' clientname = Sheets("Client_S").Cells(4 + Range("Clientname"), 1).Value ' mean ? What does the 4 and 1 doing ?
Code:
Sub SelectClientName()
On Error GoTo Err
Dim p As PivotTable
Dim sht As Worksheet
For Each sht In ThisWorkbook.Sheets
For Each p In sht.PivotTables
Select Case sht.Name
Case "Client_S"
Case Else
If Range("Clientname") = "" Then
p.PivotFields("Client").CurrentPage = _
"(All)"
Else
clientname = Sheets("Client_S").Cells(4 + Range("Clientname"), 1).Value
a = sht.Name
p.PivotFields("Client").CurrentPage = _
clientname
End If
p.RefreshTable
End Select
Next
Next
MsgBox "Pivot Updated !!!", vbInformation, "Completed"
Exit Sub
Err:
MsgBox "Client name not found"
End Sub