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"
4
  • 3
    I have a feeling it's related to using .Select. It's highly suggested to avoid doing so. Commented Sep 26, 2016 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. Commented Sep 26, 2016 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. Commented Sep 26, 2016 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. Commented Sep 26, 2016 at 19:14

1 Answer 1

1

this should probably help, i hope

Private Sub thisorthat()
Sheets(6).Columns("B").EntireColumn.Insert
End Sub
Sign up to request clarification or add additional context in comments.

3 Comments

Ha, nice catch!
I shouldve read the comments before blindly posting, OP was very close already. @BruceWayne
And I should've read the code instead of blindly saying it's probably due to .Select, :P

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.