Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Macro- Column Insert
It doesn't insert two columns: it deletes 4 (E:H), moves G2 to H2, adds the
text "new one" to G2. Perhaps this: Sub Problem() ' ' Problem Macro ' Macro recorded 8/16/2007 ' ' Keyboard Shortcut: Ctrl+Shift+P ' Columns("E:H").Delete Shift:=xlToLeft Columns("G:G").Insert Shift:=xlToRight Range("G2").FormulaR1C1 = "new one" With Range("G2").Characters(Start:=1, Length:=7).Font .Name = "Arial" .FontStyle = "Bold" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With End Sub "lostatlewisu" wrote: "lostatlewisu" wrote: After recording a macro that inserts a column in a worksheet, I run it and it inserts two columns. I don't understand why? Sub Problem() ' ' Problem Macro ' Macro recorded 8/16/2007 ' ' Keyboard Shortcut: Ctrl+Shift+P ' Columns("E:H").Select Selection.Delete Shift:=xlToLeft Columns("G:G").Select Range("G2").Activate Selection.Insert Shift:=xlToRight Range("G2").Select ActiveCell.FormulaR1C1 = "new one" With ActiveCell.Characters(Start:=1, Length:=7).Font .Name = "Arial" .FontStyle = "Bold" .Size = 8 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With Range("G3").Select End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
insert column macro will incorrectly add another value | Excel Discussion (Misc queries) | |||
Excel macro to insert uncertain numbers of column with different value | Excel Discussion (Misc queries) | |||
Excel Macro to Insert the contents of one column to other | Excel Discussion (Misc queries) | |||
Trying to insert a column using variable in a Macro | Excel Discussion (Misc queries) | |||
Dynamic column insert (macro) | Excel Discussion (Misc queries) |