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
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
Paste the below code on the selectionchange event of the worksheet.
Please Login or Register to view this content.
Here, try this:
You didn't say after selecting other row does previous return to default?
In this example it does.
When I try to paste it and run it, it displays this Capture.PNG
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.
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"?
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.
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?Please Login or Register to view this content.
Thanks
I have incorporated the changes suggested by moderator.
Last edited by terry3218; 01-08-2016 at 08:09 AM.
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)
I have fulfilled the request, thanks.
You need to enable macros (probably prompt in Yellow line to click enable)
Sorry but it still does not work on my workbook.
Can you share the screen shot of the problem you are facing?
When I change selection in my desired worksheet (after pasting that code in VBA editor), nothing happens.
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.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks