How do I write a short piece of code that defines the specific height and width that I want to assign to an existing chart. The code will be added to existing code that I have that formats the chart in other ways. This needs to be able to work with any active chart selected, not a specific named chart.
I m working with bar charts and as I've heard these labels can be a bit of a pain. I've got the labels in roughly the right position 90% of the time however that other 10% has me in rolling fits.
My issues 1. A label within the chart area is wrapped on two lines, how could I restrict Excel from wrappign the label 2. A Labels position covers some of the data reported and thus makes the graph messy
how could I find the position of the end of the bar and also the length of the datalabel so I could reposition it. Note I am using 2003 and that I am trying to use
for finding the position although this is only really where im getting to. finding the wrapping position and also being able to manipulate the length of the label is proving tricky.
I have vba code to change column width and height into mm. The code is taking alot of time to run and then hangs my excel session. The code below calls two sub routines.
Sub Change() Dim i As Long
With Application .DisplayAlerts = False . ScreenUpdating = False End With
For i = 1 To 23 SetColumnWidthMM i, 3.5 Next i End Sub...
I need to set the height of all the rows to 18.00. I need to set the width of all of the columns to 12.00, except for columns A, C, and T, which need to be at a width of 28.00.
I'm creating a map like image with Excel, and I've set the column width and row height to certain dimensions. Now I'm entering in some text into them, and I noticed that when I added in 2 digit numbers, the column width expanded a little bit. I want to prevent this from happening, and still be able to enter in the 2 digit text (since it WILL fit, and it's expanding to keep that extra bit of space).
The problem with it is, the Height and Width is arbitrary to the size of the cells at the moment. I would like to had a procedure to calculate does value. They represent the distance between the defined cells location for the image. Actually, if cells width or height change, the picture is misplaced.
I'm using a UserForm.Label to display comments which are of variable length. At the bottom of the UserForm are two CommandButtons. I'd like the gap between the Label text and the CommandButtons to be small (and preferably constant); and the CommandButtons to be at the bottom of the UserForm. This means setting the CommandButton.Top and UserForm.Height as a function of the Label.Height. The crude way I have so far achieved is to use Len(Label.Caption) as the surrogate for Label.Height but it's not very satisfactory due to word-wrap and blank lines.
I need to freeze the column and row height and width for a specific area in spreadsheet, so that it shouldnt be altered in future from any one using this sheet.
I have a userform which has vertical and horizontal scroll bars. I want to set the scroll bar width and height properties to the correct value, regardless of the size of monitor screen used to look at the user form. I'm thought of using the code below in the initiliaze event for the user form:
However, this does not seem to work. I've tried adding 250 (Me.Height + 250)to each measurement, which works, but gives the user with the larger screen a very big scroll area. I wondered if there was a formula based on the application height, that would allow the scroll height to be perfect for the user form regardless of screen size?
Rico.
PS. I also use the following code to set the user form height on initialize. I don't know if that effects anything.
This used to (and on some machines still does) work very well, but all of the sudden on my work machine, it is incredably SLOW!! The whole program takes a list of tasks and dates, and creates a wall calendar from them. Then (the offending part, below in code) looks at each cell on the wall calendar and formats it by sizing the height of a merged cell so that the entire task is displayed, then goes on to put a square around it (works fine).
The formating of the cell height/width can take up to 11 SECONDS each cell. What is happening to do this? Again, it USED to, and on some machines still does, FLY through this process. But now it just crawls. Code below, with the 3 offending lines identified.
Private Sub Fit_Height(ByVal Target As Range) Dim NewRwHt As Single Dim cWdth As Single, MrgeWdth As Single Dim c As Range, cc As Range Dim ma As Range
Application. ScreenUpdating = False With Target If .MergeCells And .WrapText Then Set c = Target.Cells(1, 1) cWdth = c.ColumnWidth Set ma = c.MergeArea For Each cc In ma.Cells MrgeWdth = MrgeWdth + cc.ColumnWidth Next
An additional item (clue?) is that, after the macro is done running, it is still unbearably slow to do anything on-screen. Grabbing the column header and changing the column width takes 5 seconds or so before it snaps to the desired width and displays correctly. Closing Excel and reopening it takes care of that problem.
More advancement (as I wait). It seems to be the Application.PageSetup that kills it. As soon as I hit the first Application.PageSetup line, the app grinds to a halt, and almost every line after that that manipulates the screen format or the page format takes 5 or so seconds EACH to process. I put them all at the end, but that really doesn't solve the problem, nor explain it, nor give me a true solution.
how to automatically set a text box size to display text contained by right-clicking the textbox and put a check in the auto-size box under "Alignment".
However I would like to set the widht of the text box and automatically adjust the height according to the number of lines of text. Is this possible by VBA code or othe means?
I have tried and been searching but cannot find the answer. Is it possible to change the row height and column width for only a selected range in my spread sheet, for example, F13:I23? I am using Excel 2010.
I'm trying to make this macro work to resize images for our fashion Look Book. In theory, it should work. But of course it does not Here is the code we are using:
Code:
Sub BIGcrop() Selection.Height = 507.6 x = Selection.ShapeRange.Width y = x / 2 Z = y - 144
[Code]....
I want all my pictures to have a height of 7.05 inches and a width of 4. The height comes out different everytime depending on the scaling of the template I'm using. I need it to adjust accordingly. I'm open to having the image move into merged cells, as long as it will first adjust the height and then crop the sides (so the orientation stays the same).
I am in the middle of building a macro for some data to be automated. I have two sheets, one of which has an existing chart but the data has been removed so now there is no values on the chart. I then have a second sheet with data on it. The range is b4:c16. I want to point this data onto my chart on the other sheet.
Refer to enclosed excel file, I have drew a chart base on the data in side. However, for the last column which is "SG Productivity(KUSD)", The column very small even cannot be seen, is there any way can enlarge columns in this field without changing other column? T
I have a bar graph with 2 series of data. Anyone knows how I can specify the order in which they appear? code looks similar to the following. The bar graph shows the second series before the first series. How do I reverse the order?
With cht .ChartType = xlColumnClustered
' first data series Set ser = .SeriesCollection.NewSeries With ser .Values = someValues .XValues = someValues End With
' second data series Set ser = .SeriesCollection.NewSeries With ser .Values = someValues .XValues = someValues End With
inability to set a default row height and still allow the occasional row that requires more space (i.e., one of it's cells has multiple lines of wrapped text) to AutoFit if necessary.
Say you have the data shown in NormalSettings.png in an Excel file (see attachments) and you want to have a little more room between the shorter rows, but not have them all set as big as the expanded rows. One way to do this in bulk is to select the entire spreadsheet and set a fixed row height, but this chops off any cells that require more space than your default height (see FixedRowHeight20.png). The only way to fix this is to manually scan through your sheet and individually select all rows with cells that need more room than your preferred row height and AutoFit them (good luck if your spreadsheet is any size...) . If you try selecting the entire sheet and choose Format-Row-Autofit, you're back to the crowded display shown in 'NormalSettings.png'.
My workaround to this annoying problem is this: choose a column that you're not using (I just select the very last column in the sheet by holding down CTRL and pressing the right arrow until the screen stops moving) and highlight the entire column by selecting the column header. Then increase the font size for that column...voila, even your blank rows will now AutoFit to the new font size rather than the font size you are using for your data...effectively increasing your default row height without sacrificing AutoFit capabilities. I find that using 16 as a dummy font size makes my data (which is font size 10, Arial) look nicely spaced out, but experiment and try stuff until you find what you like!
I'm looking to enable changing row height in a protected workbook and am scratching my head as to if there is a combination of checkboxes I need to 'allow', or if there is some other approach.
I'm using a vba macro to change the height of merged cells:
Private Sub Worksheet_Change(ByVal Target As Range) Dim NewRwHt As Single Dim cWdth As Single, MrgeWdth As Single
I want to set the default row height as 20.0 (not excel's standard 15.0). When I delete the contents in a cell that has Wrap Text property enabled, the row always reverts back to default height of 15.0 and this is too small. Is there a way to chnage the default?
Is it possible to change the Left and Width parameters of a group of TextBoxes in a For/Next loop, when the only common factor is the amount of change? The TextBoxes ar of different widths and locations. The common factor is a small TextBox the left of each TextBox which is what I am hiding under certain conditions. When hidden I need to move the TextBoxes over to where the hidden TextBox was and then enlarge the TextBox by the widt of the heddin TextBox (When the condition changes, I will resore the orginal positions and sizes).
vba did not like this bit of code in a For/Next loop:
Finding the Column with the MAX Height in comparison with other Columns of UNEVEN Height
I need two things :
1. I have several columns starting from Column B till Column F, each column having values starting from the third ROW.
Ex:-
Lets say Column B contains two values in B3 and B4, Col C three values in C3 C4 and C5, Col D four values D3,D4,D5 and D6, Col E two values in E3 and E4, Column F five values F3,F4,F5,F6 and F7.
So, the answer is F3:F7.
2.I am using 10^{4,3,2,1,0} in a particular portion of a formula, Now the number of elements in the array or in the Curly Braces depends on the number of Columns filled from Column B as explained in the Point 1.
Now, since I have five columns under consideration I have this order as mentioned here {4,3,2,1,0} , I would like to know whether I could make this dynamic, as in if there were only four columns then this would be {3,2,1,0} and if more this array could self-fill and expand..
If that's possible, then how do we use it in the formula, Is it by the virtue of the INDIRECT function?
I have just been sent a strange file, which I have attached, on its only sheet columns "A" and "B" have data entered in them, but they are not visible. You can access them if you select column "C" and use the left arrow key, but all attempts at unhiding and changing the column width are fuitless.
I have tried selecting the ENTIRE sheet, then Home>Format>Unhide Columns but it does nothing I try selecting the entire sheet, then Home>Format>Column Width and setting it to something, like "20", but again it is fruitless.
I even tried using a macro in the "Immediate Window" to ask Excel whether the columns are hidden (by using "?Columns(1).Hidden" and it returned "False") then I used a similar macro ("Cells.EntireColumn.ColumnWidth = 12.75") and again - nothing! :O
I am looking for some code that dynamically (during processing) changes the height of a userform. What I am trying to do is this: I have ten worksheets but only five are being used. I am looking to have a userform with a checkbox for each of the active sheets labeled. I don't want to have to display a form that is basically ten checkboxes with five enabled and five disabled. I want to show only the five active sheets checkboxes with a userform only large enough for the five. If six are active then a userform displaying six checkboxes and a userform large enough for only the six to be displayed.
I want to use a macro to change attributes of a series in a chart. Unbelievably, if the series has been pasted into the chart from another chart, and although the macro can address the series and even return values (eg name) correctly, the selection simply cycles to one of the original series on the chart.
Is it possible to adjust a cells' column width without the whole column width changing? EXAMPLE...I'm looking to lock rows 1-41 at certain column widths and change the column width as needed from rows 42 and below.