Implementation of a VBA Code (clickable liinks in pivot) into a macro

turyn13c

New Member
Joined
Oct 24, 2017
Messages
1
Hello everyone!
Since a few days I am working on a macro, which creates a pivot table. My goal is,that links from a report get also in pivot table clickable. I have already achieve that :) -> I edit the newly created sheet (pivot in new sheet) in VBA.
To wit by the text below:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

'Update 20140814
If Target.Cells.Count <> 1 Then Exit Sub
On Error Resume Next
Application.ActiveWorkbook.FollowHyperlink Address:=CStr(Target.Value), NewWindow:=True
End Sub

-> It works! But I just cannot implement this text into the Macro, I recorded. Is this even possible? If it is, where should I place the blue Text in the Macro Code?

Conclusion: All I want is, to generate via macro-short-cut not only the pivot table but to edit the newly created sheet as well, so it have the option mentioned in the blue text above. I hope, you can understand me
huh.gif


Please, find below the VBA Code of the recorded marco, in which I want the blue text to be implemented :)

____________________________

Sub Fehlerbericht1()
'
' Fehlerbericht1 Macro
'
' Keyboard Shortcut: Ctrl+q
'
Range("B1").Select
ActiveCell.FormulaR1C1 = "Login"
Columns("D
biggrin.gif
").Select
Selection.Delete Shift:=xlToLeft
Range("E1").Select
ActiveCell.FormulaR1C1 = "Overturn Category"
Columns("G:G").Select
Selection.Delete Shift:=xlToLeft
Columns("F:F").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.FormulaR1C1 = "Blueshift ID"
Columns("F:F").Select
Range("F2").Activate
ActiveCell.FormulaR1C1 = _
"=HYPERLINK(""https://blueshift-inspector.amazon.com/html/index.html?id=""&RC[1],""https://blueshift-inspector.amazon.com/html/index.html?id=""&RC[1])"
Range("F2").Select
Selection.AutoFill Destination:=Range("F2:F3438")
Range("F2:F3438").Select
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Sheets.Add
ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
"Transcription_overturned_2017_1!R1C1:R3438C7", Version:=6).CreatePivotTable _
TableDestination:="Sheet1!R3C1", TableName:="PivotTable1", DefaultVersion _
:=6
Sheets("Sheet1").Select
Cells(3, 1).Select
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Login")
.Orientation = xlPageField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Overturn Category")
.Orientation = xlRowField
.Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Blueshift ID")
.Orientation = xlRowField
.Position = 2
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("Overturn Category")
.PivotItems("[""content"", ""gender"", ""speakerNativity""]").Visible = _
False
.PivotItems("[""content"", ""gender""]").Visible = False
.PivotItems("[""content"", ""speakerNativity""]").Visible = False
.PivotItems("[""content"", ""state"", ""gender"", ""speakerNativity""]"). _
Visible = False
.PivotItems("[""gender"", ""speakerNativity""]").Visible = False
.PivotItems("[""state"", ""gender"", ""speakerNativity""]").Visible = False
End With
Range("A4").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Overturn Category"). _
PivotItems("[""content""]").ShowDetail = False
Range("A5").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Overturn Category"). _
PivotItems("[""criticalData""]").ShowDetail = False
Range("A6").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Overturn Category"). _
PivotItems("[""gender""]").ShowDetail = False
Range("A7").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Overturn Category"). _
PivotItems("[""speakerNativity""]").ShowDetail = False
Range("A8").Select
ActiveSheet.PivotTables("PivotTable1").PivotFields("Overturn Category"). _
PivotItems("[""state""]").ShowDetail = False
Range("B3").Select
ActiveCell.FormulaR1C1 = "Kommentar 1"
Range("C3").Select
ActiveCell.FormulaR1C1 = "Kommentar 2"
Range("B4").Select
ActiveCell.FormulaR1C1 = " "
Range("C4").Select
ActiveCell.FormulaR1C1 = " "
Range("B4").Select
Selection.AutoFill Destination:=Range("B4:B9")
Range("B4:B9").Select
Range("C4").Select
Selection.AutoFill Destination:=Range("C4:C9")
Range("C4:C9").Select
Range("B3:C3").Select
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent1
.TintAndShade = 0.799981688894314
.PatternTintAndShade = 0
End With
Range("A3:C3").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Range("B1").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Selection.Borders(xlInsideVertical).LineStyle = xlNone
Selection.Borders(xlInsideHorizontal).LineStyle = xlNone
Columns("A:C").Select
Selection.ColumnWidth = 50
Range("A2").Select
End Sub

_
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,909
Messages
6,175,313
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top