+ Reply to Thread
Results 1 to 11 of 11

dynamic formatting

  1. #1
    Registered User
    Join Date
    12-22-2009
    Location
    harrisburg, PA
    MS-Off Ver
    Excel 2003
    Posts
    3

    dynamic formatting

    I have 7 columns that repeat accross the sheet. I need to format the Horizontal alignment for every 6th column. I know the following code does one colums

    Please Login or Register  to view this content.
    Last edited by teylyn; 12-22-2009 at 08:50 PM. Reason: added code tags

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: dynamic formating

    Your post does not comply with the Forum Rules regarding use of code tags. Please amend your thread to apply code tags. Possible solutions will be suggested after complying with the Forum Rules. Thanks.

    3. Use code tags around code. Posting code without them makes your code hard to read and difficult to be copied for testing. Highlight your code and click the # button at the top of the post window. If you are editing an existing post, press Go Advanced to see the # button. For more information about these and other tags, click here.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Forum Guru teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,364

    Re: dynamic formating

    Hi fetty, welcome to the forum.

    I've added code tags for you this time, but I expect you to do it yourself from now on.

  4. #4
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: dynamic formatting

    I have no idea what alignment 2 is, but one way is
    Please Login or Register  to view this content.
    ... extending the range as necessary. If the range is too large, use a loop.

    Your code would never work; object variables require a Set, not a Let.
    Last edited by shg; 12-23-2009 at 01:50 AM.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    12-22-2009
    Location
    harrisburg, PA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: dynamic formatting

    This will not work. I need to format every 8th column. The problem is, I do not know how many I need. I am doing a loop now to add the data, but I add data like so...
    Please Login or Register  to view this content.

  6. #6
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: dynamic formatting

    Do a loop using an integer variable, you can set a step size of 8. Loop up to the column number of the last column of the range.

    Simple?

    CC

  7. #7
    Forum Contributor
    Join Date
    03-13-2009
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    136

    Re: dynamic formatting

    Couldn't you just use range and offset to accomplish this?

    Something like:

    Please Login or Register  to view this content.
    Haven't tried it but it seems like it may be in the direction you are trying to go.

  8. #8
    Forum Contributor
    Join Date
    03-13-2009
    Location
    New Jersey
    MS-Off Ver
    Excel 2007
    Posts
    136

    Re: dynamic formatting

    Just tried this and it seems to be setting every 8th column to left align:


    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    12-22-2009
    Location
    harrisburg, PA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: dynamic formatting

    This will work. I hope this help someone.....


    Please Login or Register  to view this content.

  10. #10
    Forum Expert
    Join Date
    08-27-2008
    Location
    England
    MS-Off Ver
    2010
    Posts
    2,561

    Re: dynamic formatting

    Gosh, what complex functions. Why are these necessary? I mean, doesn't
    Please Login or Register  to view this content.
    return the value of a range at the specified row and column? I'm sure I must be missing something.

    CC

  11. #11
    Forum Guru shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: dynamic formatting

    I need to format the Horizontal alignment for every 6th column.
    I need to format every 8th column. The problem is, I do not know how many I need.
    You'd get a usable answer in a single response if you described your problem accurately and completely.

+ 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