Need with Macro very ly! Will be so grateful

Hello,

If someone can help, I will be so grateful as I have been striving 2 days with it.

So, I have a source data( Tab "To go") with which I would like to run a macro. So, I have already recorded my macro(see macro22, macro 11, or macro 5 as I have tried several times).

In my macro I have filtered the data, and selected only one column to make a pivot. The final step I want this pivot to be directly printng.

However when I run the macro, the final pivot is not coming how it should be (It is only Total coming), and I don't have any idea what can be n issue.

Please could you see a file and help me, otherwise I will die )

I cannot download the file directly to here, so could you please contact me katia.dmitrenko@gmail.com, and I will send you the file.

Hello,

Understand you cannot attach your workbook ... for confidential reasons ...

However, the one thing you could do is insert the code you have created ...

It might be that ... just by looking at your macro ... a solution might pop up ....

Many thanks for your reply!

Of course I can paste here the code.

Sub macro11()

'

' macro11 Macro

'

'

Rows("1:1").Select

Range("H1").Activate

Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove

Range("H1").Select

ActiveCell.FormulaR1C1 = "Column1"

Range("H1").Select

Selection.AutoFill Destination:=Range("H1:M1"), Type:=xlFillDefault

Range("H1:M1").Select

Selection.AutoFill Destination:=Range("H1:N1"), Type:=xlFillDefault

Range("H1:N1").Select

Columns("M:M").Select

Selection.AutoFilter

ActiveSheet.Range("$M$1:$M$159").AutoFilter Field:=1, Criteria1:= _

"CONTENT - [File has been sent to BT]"

Columns("N:N").Select

Selection.TextToColumns Destination:=Range("O1"), DataType:=xlFixedWidth, _

FieldInfo:=Array(Array(0, 1), Array(7, 1), Array(9, 1), Array(15, 1), Array(63, 1), _

Array(73, 1), Array(187, 1), Array(195, 1)), TrailingMinusNumbers:=True

Columns("P:S").Select

Selection.Delete Shift:=xlToLeft

Range("N1").Select

Selection.AutoFill Destination:=Range("N1:T1"), Type:=xlFillDefault

Range("N1:T1").Select

Range("T1").Select

Selection.ClearContents

Range("S1").Select

Selection.ClearContents

Columns("Q:Q").Select

Selection.Replace What:="=-", Replacement:="", LookAt:=xlPart, _

SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _

ReplaceFormat:=False

ActiveWindow.ScrollRow = 3

ActiveWindow.ScrollRow = 39

ActiveWindow.ScrollRow = 41

ActiveWindow.ScrollRow = 43

ActiveWindow.ScrollRow = 44

ActiveWindow.ScrollRow = 46

ActiveWindow.ScrollRow = 48

ActiveWindow.ScrollRow = 50

ActiveWindow.ScrollRow = 52

ActiveWindow.ScrollRow = 54

ActiveWindow.ScrollRow = 57

ActiveWindow.ScrollRow = 58

ActiveWindow.ScrollRow = 60

ActiveWindow.ScrollRow = 62

ActiveWindow.ScrollRow = 64

ActiveWindow.ScrollRow = 67

ActiveWindow.ScrollRow = 68

ActiveWindow.ScrollRow = 71

ActiveWindow.ScrollRow = 72

ActiveWindow.ScrollRow = 74

ActiveWindow.ScrollRow = 77

ActiveWindow.ScrollRow = 78

ActiveWindow.ScrollRow = 82

ActiveWindow.ScrollRow = 84

ActiveWindow.ScrollRow = 86

ActiveWindow.ScrollRow = 88

ActiveWindow.ScrollRow = 90

ActiveWindow.ScrollRow = 93

ActiveWindow.ScrollRow = 94

ActiveWindow.ScrollRow = 96

ActiveWindow.ScrollRow = 98

ActiveWindow.ScrollRow = 100

ActiveWindow.ScrollRow = 103

ActiveWindow.ScrollRow = 104

ActiveWindow.ScrollRow = 106

ActiveWindow.ScrollRow = 108

ActiveWindow.ScrollRow = 110

Sheets.Add

ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _

"To go!R1C17:R1048576C17", Version:=6).CreatePivotTable TableDestination:= _

"Feuil1!R3C1", TableName:="Tableau croisé dynamique2", DefaultVersion:=6

Sheets("Feuil1").Select

Cells(3, 1).Select

With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _

"Column10")

.Orientation = xlRowField

.Position = 1

End With

ActiveSheet.PivotTables("Tableau croisé dynamique2").AddDataField ActiveSheet. _

PivotTables("Tableau croisé dynamique2").PivotFields("Column10"), _

"Nombre de Column10", xlCount

Range("A3:B10").Select

Selection.Borders(xlDiagonalDown).LineStyle = xlNone

Selection.Borders(xlDiagonalUp).LineStyle = xlNone

With Selection.Borders(xlEdgeLeft)

.LineStyle = xlContinuous

.ColorIndex = 0

.TintAndShade = 0

.Weight = xlMedium

End With

With Selection.Borders(xlEdgeTop)

.LineStyle = xlContinuous

.ColorIndex = 0

.TintAndShade = 0

.Weight = xlMedium

End With

With Selection.Borders(xlEdgeBottom)

.LineStyle = xlContinuous

.ColorIndex = 0

.TintAndShade = 0

.Weight = xlMedium

End With

With Selection.Borders(xlEdgeRight)

.LineStyle = xlContinuous

.ColorIndex = 0

.TintAndShade = 0

.Weight = xlMedium

End With

Selection.Borders(xlInsideVertical).LineStyle = xlNone

Selection.Borders(xlInsideHorizontal).LineStyle = xlNone

Range("B7").Select

Selection.ShowDetail = True

Range("A3:B10").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

With Selection.Borders(xlInsideVertical)

.LineStyle = xlContinuous

.ColorIndex = 0

.TintAndShade = 0

.Weight = xlThin

End With

With Selection.Borders(xlInsideHorizontal)

.LineStyle = xlContinuous

.ColorIndex = 0

.TintAndShade = 0

.Weight = xlThin

End With

Range("A3").Select

With ActiveSheet.PivotTables("Tableau croisé dynamique2").PivotFields( _

"Column10")

.PivotItems("(blank)").Visible = False

End With

Range("A3").Select

ActiveSheet.PivotTables("Tableau croisé dynamique2").CompactLayoutRowHeader = _

"Numéro de lot"

Range("B3").Select

ActiveSheet.PivotTables("Tableau croisé dynamique2").DataPivotField.PivotItems( _

"Nombre de Column10").Caption = "Total"

Range("A3:B9").Select

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _

IgnorePrintAreas:=False

End Sub

Thanks again and waiting for your respond.

Hello,

Your macro looks like being the result of the Macro Recorder ...

In addition, you have performed many actions which are not truly related to your business objective ...

How Urgent is your situation ???

James007 a écrit :

Hello,

Your macro looks like being the result of the Macro Recorder ...

In addition, you have performed many actions which are not truly related to your business objective ...

How Urgent is your situation ???

Yes, I was recordng actions, as I don't know visual basic of course

Honestly my main purpose is to create macro which will do for me the following: select data from a big data extract and after make a pivot from it, and then print that pivot.

Looking easy but indeed I can not find the problem with that pivot creation honestly:(

Hello,

can you send us a file ?

We need additional information to help you.

Jean-Eric a écrit :

Hello,

can you send us a file ?

We need additional information to help you.

Many thanks for your response!

Here you can see the file, the macro which is the last and the most successful is named "Macro".

The first Worksheet is the data extract that I have and second one is the one where I created the macro.

Waiting for your reply, nd thanks again. Please, let me know if you have any other questions.

28extract-macro.xlsm (79.39 KB)
Search for threads similar to "need macro very grateful"