+ Reply to Thread
Results 1 to 9 of 9

macro to change row height based on criteria in row above

  1. #1
    Registered User
    Join Date
    01-30-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    5

    macro to change row height based on criteria in row above

    Thank you to anyone who helps me with this. I'm on a deadline. I'm amending a workbook someone else created and I'm brand new to VB. I've attached a screenshot to illustate what I am doing.

    I've got a table that has over 200 rows and the users enter information into the rows over a year. The creator of the sheet has set it up so there is a "z" in the second cell of each row and as this cell is overtyped with the new information the row changes colour and is included in the print macro that is set up.

    I want to add in a macro that changes the row height to 0 based on the "z" being present in the row above 2nd cell. So all that is showing in the table are the rows that have info in them and one blank one underneath. So everytime a new row of info is entered either a new line will reveal itself underneath or there is a control button on the sheet that the user can press to reveal a new empty line.

    I don't know how to write VB, but I've found some code online that claims to do waht I need, but I need it to be altered to use the presence of the "z" in the row above (2nd column) as the trigger for the rule:


    Please Login or Register  to view this content.
    Or should I be starting off with minimised rows and changing it so the height increases as the "z" in the row above is overtyped?

    The table is rows 12:217.

    Can this happen automatically as the z is overtyped or does the macro need to be triggered by a control button for example?

    Is there a better way to do this? I don't want to get rid of all the extra empty rows and have a macro to create a new row for 2 reasons: 1.They have formulas and macros running set up by the creator that I don't want to mess with and 2. There are 52 sheets in the workbook, 1 for each week of the year and the next sheet takes the information from the previous weeks sheet so on the last sheet, number 52, it has every line that has been entered over the year from week one to week 51 carried over. If I created a new row on week2, I would have to then create that row on every sheet following week 2 and I think that would make it more complicated.
    Attached Images Attached Images
    Last edited by Axild; 01-30-2009 at 05:28 AM. Reason: Missed off the code tags

  2. #2
    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

    Re: Help Urgent macro to change row height based on criteria in row above

    Your post does not comply with Rule 3 of our Forum RULES. 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 # at the top of your post window. For more information about these and other tags, found here
    _________________________________________


    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 !!!

  3. #3
    Registered User
    Join Date
    01-30-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: macro to change row height based on criteria in row above

    Thank you. I apologise. I'm pretty new to all this.

    Have tagged now.

  4. #4
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: macro to change row height based on criteria in row above

    Please post a copy of your book as most people will not try to duplicate a book from your picture
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  5. #5
    Registered User
    Join Date
    01-30-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: macro to change row height based on criteria in row above

    The whole workbook is about 18MB so I've attached a file with one tab.

    Hope this will be enough.

    Thanks,

    Alex
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    01-30-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: macro to change row height based on criteria in row above

    Someone has given me the following code but I can't get the macro to run. If I put anything in the brackets after the sub name the macro won't run and it disappears from the macro list. Can anyone point me in the right direction for where I am going wrong.

    Please Login or Register  to view this content.

  7. #7
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: macro to change row height based on criteria in row above


  8. #8
    Registered User
    Join Date
    01-30-2009
    Location
    England
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: macro to change row height based on criteria in row above


  9. #9
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: macro to change row height based on criteria in row above

    Axild

    I suggest you read the details on cross posting before you post another the same question/problem on mutlipe forums

    http://www.excelguru.ca/node/7

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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