Accntgtemp4
New Member
- Joined
- Jun 19, 2018
- Messages
- 2
[TABLE="width: 100%"]
<tbody>[TR]
[TD]Hi,
I am having trouble with a Macro I created for the purpose of formatting a report. The issue is that when the Macro is executed it eventually deletes everything.
The code is the following:
I steeped into the code and on the following line its were the Macro selects everything and deletes it:
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Could I be helped?
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 99%"]
<tbody>[TR]
[TD][TABLE="width: 100%"]
<tbody>[TR]
[TD="colspan: 2"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
<tbody>[TR]
[TD]Hi,
I am having trouble with a Macro I created for the purpose of formatting a report. The issue is that when the Macro is executed it eventually deletes everything.
The code is the following:
Code:
Range("B3:B5").Select
Selection.Cut
Range("A3").Select
ActiveSheet.Paste
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Columns("B:O").Select
Selection.ColumnWidth = 8
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$10"
.PrintTitleColumns = ""
End With
Application.PrintCommunication = True
ActiveSheet.PageSetup.PrintArea = ""
Application.PrintCommunication = False
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.25)
.RightMargin = Application.InchesToPoints(0.25)
.TopMargin = Application.InchesToPoints(0.4)
.BottomMargin = Application.InchesToPoints(0.25)
.HeaderMargin = Application.InchesToPoints(0.3)
.FooterMargin = Application.InchesToPoints(0.3)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 6
.PrintErrors = xlPrintErrorsDisplayed
.OddAndEvenPagesHeaderFooter = False
.DifferentFirstPageHeaderFooter = False
.ScaleWithDocHeaderFooter = True
.AlignMarginsHeaderFooter = True
.EvenPage.LeftHeader.Text = ""
.EvenPage.CenterHeader.Text = ""
.EvenPage.RightHeader.Text = ""
.EvenPage.LeftFooter.Text = ""
.EvenPage.CenterFooter.Text = ""
.EvenPage.RightFooter.Text = ""
.FirstPage.LeftHeader.Text = ""
.FirstPage.CenterHeader.Text = ""
.FirstPage.RightHeader.Text = ""
.FirstPage.LeftFooter.Text = ""
.FirstPage.CenterFooter.Text = ""
.FirstPage.RightFooter.Text = ""
End With
Application.PrintCommunication = True
End Sub
I steeped into the code and on the following line its were the Macro selects everything and deletes it:
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Could I be helped?
[/TD]
[/TR]
</tbody>[/TABLE]
[TABLE="width: 99%"]
<tbody>[TR]
[TD][TABLE="width: 100%"]
<tbody>[TR]
[TD="colspan: 2"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD="colspan: 2"][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
Last edited by a moderator: