Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Macro is deleting everything!
Can anyone tell me why, when I run a macro, it deletes a lot of my
information? I'm just inserting some columns and formatting a row. |
#2
|
|||
|
|||
If you paste the macro code into a message, and post it, someone may be
able to help you solve the problem. vmagal1 wrote: Can anyone tell me why, when I run a macro, it deletes a lot of my information? I'm just inserting some columns and formatting a row. -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
#3
|
|||
|
|||
Rows("1:1").Select
Selection.Insert Shift:=xlDown Range("A1").Select ActiveCell.FormulaR1C1 = "RKP3830C1TEST (Container Report) Date" Range("A1:M1").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge Selection.Font.Bold = True With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With Rows("1:1").Select Selection.RowHeight = 24 Columns("A:A").Select Range("A2").Activate Selection.Insert Shift:=xlToRight Range("A1:N1").Select Range("B1").Activate With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With Selection.UnMerge With Selection .HorizontalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge Columns("I:I").Select Range("I2").Activate Selection.Insert Shift:=xlToRight Range("I2").Select ActiveCell.FormulaR1C1 = "Ocean" With ActiveCell.Characters(Start:=1, Length:=5).Font .Name = "Arial" .FontStyle = "Bold" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With Range("K2").Select End Sub "Debra Dalgleish" wrote: If you paste the macro code into a message, and post it, someone may be able to help you solve the problem. vmagal1 wrote: Can anyone tell me why, when I run a macro, it deletes a lot of my information? I'm just inserting some columns and formatting a row. -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html |
#4
|
|||
|
|||
Scroll to your right a few columns.
I put my test data in A1:N47, after I ran your macro, my test data was in AN2:BA48. So maybe it's not deleted--just shifted over. (You do insert a bunch with lots of columns selected.) vmagal1 wrote: Rows("1:1").Select Selection.Insert Shift:=xlDown Range("A1").Select ActiveCell.FormulaR1C1 = "RKP3830C1TEST (Container Report) Date" Range("A1:M1").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge Selection.Font.Bold = True With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With Rows("1:1").Select Selection.RowHeight = 24 Columns("A:A").Select Range("A2").Activate Selection.Insert Shift:=xlToRight Range("A1:N1").Select Range("B1").Activate With Selection .HorizontalAlignment = xlGeneral .VerticalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With Selection.UnMerge With Selection .HorizontalAlignment = xlCenter .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge Columns("I:I").Select Range("I2").Activate Selection.Insert Shift:=xlToRight Range("I2").Select ActiveCell.FormulaR1C1 = "Ocean" With ActiveCell.Characters(Start:=1, Length:=5).Font .Name = "Arial" .FontStyle = "Bold" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = 1 End With Range("K2").Select End Sub "Debra Dalgleish" wrote: If you paste the macro code into a message, and post it, someone may be able to help you solve the problem. vmagal1 wrote: Can anyone tell me why, when I run a macro, it deletes a lot of my information? I'm just inserting some columns and formatting a row. -- Debra Dalgleish Excel FAQ, Tips & Book List http://www.contextures.com/tiptech.html -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Deleting excess data in a macro | Excel Discussion (Misc queries) | |||
Playing a macro from another workbook | Excel Discussion (Misc queries) | |||
Date macro | Excel Discussion (Misc queries) | |||
After deleting a macro, I still get the pop-up when opening file | Excel Worksheet Functions | |||
Macro and If Statement | Excel Discussion (Misc queries) |