+ Reply to Thread
Results 1 to 16 of 16

Selecting most of a row

  1. #1
    Forum Contributor
    Join Date
    10-20-2008
    Location
    Gloucestershire
    Posts
    134

    Selecting most of a row

    How would i go about selecting a row to the left of any active cell. As far as column B

    Please Login or Register  to view this content.
    i tried this but it selects the whole row to the left

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Try:

    Please Login or Register  to view this content.
    HTH

    Jason

  3. #3
    Valued Forum Contributor Shijesh Kumar's Avatar
    Join Date
    05-26-2008
    Location
    Bangalore / India
    MS-Off Ver
    2000
    Posts
    717
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    10-20-2008
    Location
    Gloucestershire
    Posts
    134
    Thank you

    Do you know how i would use it in this code

    Please Login or Register  to view this content.
    Month Column = 14 at this point (is Variable)

  5. #5
    Forum Contributor
    Join Date
    10-20-2008
    Location
    Gloucestershire
    Posts
    134
    Forgot to say it needs to calculate from MonthColumn variable(14) back to column(B)

    And give the total

  6. #6
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Are you trying to create the correct SUM formula? If so, this may be what you are looking for:

    Please Login or Register  to view this content.
    HTH

    Jason

  7. #7
    Forum Contributor
    Join Date
    10-20-2008
    Location
    Gloucestershire
    Posts
    134
    Im afraid the code didnt work

    I need a total for columns "B" to the one before "MonthColumn"(variable)

    And need rows 4 and 7-16 filled as shown in my macro

    The amount of columns is dynamic rows are not. I tried xlToLeft and such but havent been successeful

    George

  8. #8
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Hi George.

    Once you run the procedure I listed above, what are the formulas in the cells? What "didnt work" about the procedure?

    Jason

  9. #9
    Forum Contributor
    Join Date
    10-20-2008
    Location
    Gloucestershire
    Posts
    134
    Error 1004 Object Error on row

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    10-20-2008
    Location
    Gloucestershire
    Posts
    134
    It does add a total heading to row B4

  11. #11
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    When the error is presented, what is the value of MonthColumn? You can see this by clicking Debug, then hovering the cursor over the variable MonthColumn.

  12. #12
    Forum Contributor
    Join Date
    10-20-2008
    Location
    Gloucestershire
    Posts
    134
    MonthColumn Is 12 at error

    It pastes the Total heading in the correct place. which is a good sign. The rest should follow

    I defined i As Integer Is this wrong may cause an object error.

    George

  13. #13
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Interesting... See if this works:

    Please Login or Register  to view this content.
    If not, is it possible you could post up a copy of your workbook?

  14. #14
    Forum Contributor
    Join Date
    10-20-2008
    Location
    Gloucestershire
    Posts
    134

    Smile

    Thats Great thanx, it worked successfully and added the column after the variable column number.

    I forgot to mention the average column so i just updated that and it now works.


    Please Login or Register  to view this content.
    Than you for your time

    George

  15. #15
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208
    Glad it worked, George.

    By the way, you should move the average formula after the loop, or it will insert the formula 9 times. (Move it between Next i and End With).

    Jason

  16. #16
    Forum Contributor
    Join Date
    10-20-2008
    Location
    Gloucestershire
    Posts
    134
    Yep i know what you mean didnt think about that

    Please Login or Register  to view this content.
    George

+ 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