+ Reply to Thread
Results 1 to 18 of 18

Simple VBA editing.. need some insight!

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    One thing at a time.

    First, I missed the copy a column and insert as a row.

    Is this what you really want to accomplish? A column contains 65,536 cells and a row only contains 256 cells, at least in Excel up through 2003. This is not reasonable, at least to me.

    Next, the code I show works for me, I have sent it to people in different companies with different versions of Excel and it works for them.

    Did you place the first two routines into ThisWorkbook via the VBE Window? And you put the Third Routine into a normal module?

    Let's try a little trouble shooting:
    • Insert a new sheet into your workbook that you can delete when done.
    • In cell B5 and B6 enter something different for each.
    • Select Cell B6 as the active cell.
    • Press the key combination <Alt><F8> to bring up the macro dialog
    • Select Copy_Insert_Row
    • Run the macro
    Do you now have three cells with entries(B5, B6, & B7?) Cells B6 and B7 should have the same data.
    Thanks!
    Dennis

    I am using Windows 7 and Office 2007, all of my posts are based on this.

  2. #2
    Forum Contributor
    Join Date
    03-24-2005
    Location
    Wisconsin
    MS-Off Ver
    2007
    Posts
    378

    Oops...

    I applogize, I just read the entire thread again.

    I will modify my routine to insert a single new row, and copy the formula from the previous row cells in columns B, H, & J into the same columns in the new row.

  3. #3
    Forum Contributor
    Join Date
    04-05-2007
    Location
    Arlington, TX
    MS-Off Ver
    Office 2010
    Posts
    164
    Quote Originally Posted by DCSwearingen
    I applogize, I just read the entire thread again.

    I will modify my routine to insert a single new row, and copy the formula from the previous row cells in columns B, H, & J into the same columns in the new row.
    I really appreciate your time. I'm still getting accustomed to programming macros, and learning all of the excel triggers and syntax.

    How exactly do you reference a column within a row? - that is my major hang up .. recording macros only grabs a specific cell, but not a column within the row... allowing it to be unique for each row.

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Thanks for wrapping your code

    How exactly do you reference a column within a row? - that is my major hang up .. recording macros only grabs a specific cell, but not a column within the row... allowing it to be unique for each row.
    These snippets may help

    ActiveCell.Column
    will return column number

    Cells(3, ActiveCell.Column).Address
    Will look at row 3 and activecolumn number to return address.

    Range(Cells(1, ActiveCell.Column), Cells(5, ActiveCell.Column))
    is a range from Row1 & column to Row 5 and Column

    This link may also help

    http://msdn2.microsoft.com/en-us/lib...ffice.11).aspx

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1