Consulting

Results 1 to 4 of 4

Thread: Solved: New procedure at end of code?

  1. #1

    Solved: New procedure at end of code?

    First, I am pretty new to VBA so this may be stupid easy, but I hope someone can help.

    We have a macro and the person who wrote the code no longer works for us. I'm trying to use my limited VBA knowledge to edit it.

    The macro imports data into excel from a folder containing several other spreadsheets.

    After the code is done importing the data, I want to simply insert a column. I used the following code, but it just isn't working. If someone could please help me out, I would appreciate it.

    Public Static Sub insertColumn(ByRef Sheets As Sheets)

    Worksheets("Summary").Range("AJ1").EntireColumn.Insert


    End Sub

  2. #2
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Hi there, welcome to the board!

    While the code you posted should work, we can't be sure. When working with multiple workbooks, it's generally a good idea to specifically reference that workbook. You have the worksheet referenced explicitly, just not the book. Is there any way you could post the entire code? That would give us a much better idea of what you're working with.

  3. #3
    I appreciate it, but I solved my problem. I relocated the code within the main procedure. Might not make sense, but as I said, I'm pretty new to all this.

  4. #4
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Great! Can you mark your thread as Solved? (Look at the Thread Tools button.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •