Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
vmagal1
 
Posts: n/a
Default 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   Report Post  
Debra Dalgleish
 
Posts: n/a
Default

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   Report Post  
vmagal1
 
Posts: n/a
Default

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   Report Post  
Dave Peterson
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting excess data in a macro ChuckW Excel Discussion (Misc queries) 3 February 24th 05 06:48 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
After deleting a macro, I still get the pop-up when opening file Anne Excel Worksheet Functions 2 December 8th 04 05:31 PM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


All times are GMT +1. The time now is 08:12 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"