+ Reply to Thread
Results 1 to 16 of 16

A code to change the height of row active cell?

  1. #1
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    A code to change the height of row active cell?

    Hi everyone! I need a macro that automatically changes the height of the row of the whichever cell I am in to 20 pixels. So can anyone guide me ?

    Regards

  2. #2
    Registered User
    Join Date
    02-09-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: A code to change the height of row active cell?

    Paste the below code on the selectionchange event of the worksheet.

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: A code to change the height of row active cell?

    Here, try this:

    You didn't say after selecting other row does previous return to default?
    In this example it does.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: A code to change the height of row active cell?

    When I try to paste it and run it, it displays this Capture.PNG

  5. #5
    Registered User
    Join Date
    02-09-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: A code to change the height of row active cell?

    Not able to see the picture and hence cannot comment on what kind of error you are getting. Anyways you donnot need to run the code by pressing F5 or run button. Change selection in your excel sheet and the row height would change.

  6. #6
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: A code to change the height of row active cell?

    When I try to run it , the standard macro dialog box opens which asks me to select which macro to run, and this macro doesn't appear. Secondly, sorry but I don't get what you mean by "Change selection in your excel sheet and the row height would change"?

  7. #7
    Registered User
    Join Date
    02-09-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: A code to change the height of row active cell?

    Please see the attached file. i have written the code on the sheet1. Paste this code in the sheet for which you want to change the row height. After pasting the code you just need to change the selection by clicking on some other row and this code would do the trick(you don't need to press run button or press F5 or go to the macros to run this macro). Selection change means selecting some other cell. Hope this clarifies your doubt.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: A code to change the height of row active cell?

    Please Login or Register  to view this content.
    The code is working in your worksheet, but it is not working in my worksheet. Do I have to change anything in this code like name of the workbook or something to get it working on the other sheet?

    Thanks

    I have incorporated the changes suggested by moderator.
    Last edited by terry3218; 01-08-2016 at 08:09 AM.

  9. #9
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: A code to change the height of row active cell?

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

  10. #10
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: A code to change the height of row active cell?

    I have fulfilled the request, thanks.

  11. #11
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,596

    Re: A code to change the height of row active cell?

    You need to enable macros (probably prompt in Yellow line to click enable)

  12. #12
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: A code to change the height of row active cell?

    Sorry but it still does not work on my workbook.

  13. #13
    Registered User
    Join Date
    02-09-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: A code to change the height of row active cell?

    Can you share the screen shot of the problem you are facing?

  14. #14
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: A code to change the height of row active cell?

    When I change selection in my desired worksheet (after pasting that code in VBA editor), nothing happens.

  15. #15
    Registered User
    Join Date
    02-09-2014
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    60

    Re: A code to change the height of row active cell?

    Are you pasting the code under the same sheet? f you have pasted the code in a module, it would not work. you would need to paste this code under the same worksheet in VBE.

  16. #16
    Registered User
    Join Date
    10-12-2015
    Location
    Canada
    MS-Off Ver
    Excel 2013
    Posts
    95

    Re: A code to change the height of row active cell?

    Quote Originally Posted by excelfandoo View Post
    Are you pasting the code under the same sheet? f you have pasted the code in a module, it would not work. you would need to paste this code under the same worksheet in VBE.
    Now it works. Thanks a lot everyone!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 4
    Last Post: 03-21-2015, 08:18 PM
  2. vba code to update all pivot tables based on cell change on active sheet only
    By seatejo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-08-2014, 08:34 PM
  3. [SOLVED] Worksheet change event code to display message box based on active cell offset content
    By Nitefox in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-12-2014, 02:52 PM
  4. Need a tweak to worksheet change code that autofits the row height of merged cells
    By David M. in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-26-2014, 01:33 PM
  5. Code to recognize where selection change active cell originates
    By jman0707 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-14-2008, 12:27 PM
  6. change height of single cell
    By Alex01 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-23-2007, 07:57 AM
  7. [SOLVED] how to change one cell height not the row
    By Candice in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-24-2005, 02:56 AM

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