Hi Everyone,
I have the following code working well in my worksheet but I would like it to be activated every time that a new selection is chosen by the user on a drop down list (located in cell C10) rather than having to create a seperate button.
Please remember that I am very much a beginner so I will need step-by-step instructions on how to perform this action.
Thank you in advance
Here is the code.
Sub Autofix() ' ' Autofix Macro ' Macro recorded 12/05/2009 by Sean Hughes ' ' Keyboard Shortcut: Ctrl+a ' Range("B193").Select Selection.Rows.Autofit Range("B193:J193").Select With Selection .HorizontalAlignment = xlCenter .VerticalAlignment = xlTop .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge With Selection .HorizontalAlignment = xlLeft .VerticalAlignment = xlTop .WrapText = True .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = True End With End Sub
You want to avoid merging cells they will eventually cause you problems in either vba or worksheet functions
Hope that helps.
RoyUK
--------
If you are pleased with a member's answer then use the Star icon to rate it, if you are pleased enough to part with cash consider a donation to Children in Need
For Excel Tips & Solutions, free examples and tutorials why not check out my downloads
New members please read & follow the Forum Rules
Remember to mark your questions Solved and rate the answer(s)
Thanks for your help Roy but my document contains huge amounts of straight text and therefore I need merged cells in order to keep the paragraph formatting consistent.
In any case my code works really well. All I need is for it to be launched when I select a new option on my drop down box.
Does anyone have an answer for me? I would be very appreciative.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks