0

I tried with both relative cell references and absolute references. I tried recording a macro and writing it in VBA.

It is supposed to take raw data and format it. This includes inserting two new columns to add Notes.

I have included a snip of the macro. I know the problem is not with the rest of the macro because the issue happens when I use this alone.

Rows("1:1").Select
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Selection.ClearFormats
Columns("B:B").Select
Selection.Insert Shift:=xlToRight, CopyOrigin:=xlFormatFromLeftOrAbove
Range("B3").Select
ActiveCell.FormulaR1C1 = "Date"
Range("F3").Select
ActiveCell.FormulaR1C1 = "Notes"
Community
  • 1
  • 1
Desi D
  • 19
  • 6
  • 3
    I have a feeling it's related to using `.Select`. It's ***highly*** suggested to [avoid doing so](http://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba-macros). – BruceWayne Sep 26 '16 at 18:50
  • Thank you. I will try. I am a total novice.. I am looking at how to use Activate and variables but I doubt I will be able to figure out how to use those to do the same thing without hitting many brick walls along the way. Ah well. – Desi D Sep 26 '16 at 19:06
  • We all hit brick walls to get to where we are, and expect to hit many more. The key is to realize you can go around/through the walls by digging around, asking questions, and trying alternatives. – BruceWayne Sep 26 '16 at 19:08
  • Ha! I think I have got something!' `Range("B1").EntireColumn.Insert Range("A1").EntireRow.Insert` :) Seems to work well enough I think. – Desi D Sep 26 '16 at 19:14

1 Answers1

1

this should probably help, i hope

Private Sub thisorthat()
Sheets(6).Columns("B").EntireColumn.Insert
End Sub
Doug Coats
  • 6,255
  • 9
  • 27
  • 49