VBA - Adding Border Line To Bottom Row Of Set Print Area
Oct 15, 2009
I am using the following macro to set print area which I found on the net. I am trying to modify it as I would also like to place a border line on the bottom row but cant find anything to assist me despite searching through several threads.
Dim myrange As String
With ActiveSheet.Range("A:A")
myrange = .Find(What:="*", After:=.Range("A1"), LookIn:=xlValues, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlPrevious, MatchCase:=False).Address
End With
ActiveSheet.PageSetup.PrintArea = "$K$1:" & myrange
End Sub
View 9 Replies
ADVERTISEMENT
Feb 25, 2009
Using Excel 2003 I am trying to write a macro to set the print area according to the amount of data in a particular range of cells. I find I can include this instruction
View 2 Replies
View Related
Feb 12, 2013
I have a workbook with multiple sheets that I need to print.
Is there a way to create a fixed print area within which you can mess around with formatting without extending or shrinking the print area?
I have tried adjusting the margins settings so that they are all the same, but this does nothing to keep a fixed print area.
View 1 Replies
View Related
Jul 19, 2012
I need to underline certain cells based on the value of a cell in this case from column "E". Right now I run a macro to look at the value in each cell in column "E". THe macro then adds a certain amount of blank rows below the that row. So, if cell E1 has a 4, my macro runs a calculation that says 4 divided by 3, +2. So it would add 3 blank rows under row 1. It does this all the way down my column of data.
Now it gets tricky. To the right of column E, I have 6 blank columns, F,G,H,I,J,K. F,H, and J are spacer rows with no data. I need them blank with out any borders. Columns G, I, and K are the columns that I am wanting to add borders on the bottom of the cells based on the value in column E.
I need code to look at the value in E1, in this case 4, and add borders to 4 cells, in this case G1, I1, and K1 and then G2. If the value would have been 5, I need I2, 6 would add a border to K2 and 7 would add a border to G3. Catch my drift?
So, every cell in column E will not have a value because of me adding blank rows. So when there is a value, I need to add borders starting on the same row the value is in. At most, there will only be 3 underlined cells per row because of the format. Once the top row is filled, I need to drop down to the very next row.
View 9 Replies
View Related
Jul 9, 2014
Possible to create a macro that would detect end page (jumping from page 1 to page 2 for instance) and add a bottom border at the last row of the page.
I have attached a sample where I highlight in green the end of the page and added manually the bottom border (I did it only for the first end pages).
View 7 Replies
View Related
Jul 25, 2009
I want to add borders to a range depending on the value in the "a" column. Normally I want a left border in cell "a", a right border in cell "h" and bottom border in cells "a" to "h". However if the value in cell "a" is the same as the cell below I do not want the bottom border.
Cell "a" contains the names of customers using our facilities each day. Some customers use several facilities on the same day. I want the borders to encompass all facilities used by each customer per day e.g. range "a1:h8" might need bottom borders on all rows, because they are single customers using only one facility that day but ranges "a9:h11" would require bottom borders only on row 11, because that customer is using three of our facilities that day.
Set Rng = ActiveSheet.Range("a:h").SpecialCells(xlCellTypeConstants)
change the Range to "a:h"
and:-
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeRight)..........
View 5 Replies
View Related
Jul 27, 2009
I am now trying this using Conditional Formatting in Excell 2000; so limited to 3 conditions. However I cannot get it work with multiple conditions:-
Values;-
A34 = Heritage Rly Assn Business Development Committee
A35 = North London Rly Historical Society
C34 = 23/09/2009 (formatted as WEEKDAY DD MMM YYYY)
D34 = 23/09/2009 13:30 (formatted as HH:MM)
In Cell C34
Format condition 1:-
=A34<>A35 , Format Bottom Border
Format condition 2:-
=AND(WEEKDAY(C34)>1,WEEKDAY(C34)<7,HOUR(D34)<18,A34<>A35), Format Bottom Border and Yellow pattern
Format condition 3:-
=AND(WEEKDAY(C34)>1,WEEKDAY(C34)<7,HOUR(D34)<18), FormatYellow pattern
In cell c34 Format condition 1 activates NOT condition 2.
In another cell, C13, condition 3 correctly operates; in this row A13 = A14. Condition 1 works i.e. the cells A1 and A2 are the same only cell A2 has the bottom border and if Cell A2 and A3 are different there is a bottom border in both cells. There must be something wrong with my formula in condition 2 but I can't see what; condition 2 is just condition 1 amd 3 amalgamated.
The condition 2 should read:
If the date is not a Saturday or Sunday in cell C34 and the time is before 18:00 hours in Cell D34 and the name in the "a" cell i.e. A34 does not equal the name in the "a" cell below this one i.e. A35 put in a bottom border and colour the cell yellow.
View 2 Replies
View Related
Nov 6, 2012
I want to apply a bottom page border in my excel file. The page border should be fixed, i.e. if you insert a row above the border then the border should not shift as well.
View 2 Replies
View Related
Oct 27, 2011
In Excel 2010 I need to place a text box between the X axis and the bottom border of a chart.
How can increase the white space between the X axis and the bottom border to allow me to do this?
View 1 Replies
View Related
Apr 11, 2013
How can I print 2 selected area (highlighted area). I know there is a trick to do that. Right now I can only select (highlight) one area to print, but would like to know how to print 2 or more areas at same time
View 7 Replies
View Related
Mar 27, 2009
I just converted from Excel 2003 to 2007 and print previewed a worksheet and find a tiny image with a small portion of the print area. When I look at the sheet in page break preview mode, I see the 8.5 x 11 sheet broken up into approx 77 smaller sheets. When I try to move the page breaks to include the whole sheet it states the change cannot be made as it will result in an image less than 10%. I have attached two images - the first shows the print preview I get, and the second show the multiple pages when I view in page break.
View 4 Replies
View Related
May 16, 2008
This seems so simple but i looked everywhere and i cannot find the vba script to add a 3 point solid black line border around the chart and plot area of my graphs. The record macro option does not record this.
View 3 Replies
View Related
Nov 1, 2006
I am trying to graph the following data in an area chart with line charts superimposed on the area chart. I have a lot of data (and a lot going on) so I'm trying to figure out the best way to show this in excel from a functional standpoing (i can't get this to work in excel!!) to also an asthetic standpoint (dont want it to look terrible or illegible). This is what I'm trying to chart:
1) Weather data (temperature) by region:
So one region, would be: Northwest
I would like the "area" (so a shaded region) to be the min/max of the temperature data for each month.
2) I would like to show the temperature for each year as a line graph on the chart - so you can see if a year falls in or out of the shaded region.
3) I would like to show a company's sales increases across the same months per year as separate line charts. I may choose to just show the biggest outlier year in the end... or to show 2006 (the latest data).
What I am trying to convery with the chart is that the company's sales is or is not tied to weather deviations. I have attached an excel file with the data. I haven't been able to use the area chart or get a two axis chart to work or get it to look even remotely professional.
View 3 Replies
View Related
Aug 14, 2013
I'm trying to use VBA to draw a border using the drawing toolbar and using the line. i need it to draw a border around a select area i hightlight.
i have attached a example below, but not sure if it will appear.
View 1 Replies
View Related
Apr 16, 2012
Why is the VBA for putting a simple border around a cell so convoluted. For example cell A2:
Code:
Sub CellBorder()
Range("A2").Select
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
[Code] ........
So many lines to put a simple - single line border (square) around a cell.
View 3 Replies
View Related
May 5, 2013
I am trying to add several border lines to the bottom of a row from A to AI start from row 12.
There is probably a few things you need to know
1. Starting from row 11 each data section is two rows deep
2. The data section could be repeated and if this is the case do not insert border until it changes
3. The border line needs to be added underneath the second line i.e. to split the different types of data
View 5 Replies
View Related
Jan 26, 2007
I have a range of data (not a named range, just a selection) and I typically want:
- the top 2 rows to have a heavy border on the left, top and right sides with a light line on the bottom.
- On the bottom line, I need a heavy line on the left, bottom and right sides.
- The body in between needs to have heavy lines on the left and right sides with dots for all in between.
The top 2 lines show titles, the bottom line is for totals and the body in between shows the data.
I've made 3 separate macros that do each part but I'm hoping that they can be integrated into one.
View 9 Replies
View Related
Sep 21, 2007
I have this simple code which sets the objects format as default.
Private Sub FormatTextBox()
ActiveSheet.Shapes("FormatBox").Select
Selection.ShapeRange.SetShapesDefaultProperties
End Sub
Is there a way to set an objects shape to the default format...not as default?
ie: if the default line color is blue. what code could i use to set an object with a black line color, to the default blue?
View 3 Replies
View Related
May 20, 2012
(Excel 2003, using Format/Cells)
I have selected a range of multiple rows and columns. I can change the alignment, cell color, where border lines appear, and the color of border lines.
However, I can not change the border line style. No matter what style I select, when drawn on the sheet it apppear as a thin solid line. I've tried all the dashed/dotted line options, but they appear to have no effect.
Ultimately, I want to color alternating rows of cells, and (since coloring hides grid lines) I want to add border lines the same color and style as the hidden grid lines.
View 2 Replies
View Related
Aug 24, 2007
with creating vb code that will select certain rows in a spreadsheet, set the print area to those rows and print them out, and then reset the print area back to default.
The data is all on one sheet, but is split into 5 different areas, each below the next, with the column headers at the top of each.
e.g.
header_____header_____header
data_______data_______data
data_______data_______data
data_______data_______data
header_____header_____header
data_______data_______data
data_______data_______data
data_______data_______data
and so on. At the press of a button it'll set the print area to the first section and print (the section includes the headers as well as the data). Then at the press of another button it'll set the print area to the next section. There could be any amount of rows of data in each section so it needs to cope with that.
View 9 Replies
View Related
Apr 8, 2014
When printing, how to automatically add a line at the bottom of each page? I don't want to make the line physically there. Just show the line in the page when printed.
View 2 Replies
View Related
Dec 1, 2013
The title in the attached chart is a camera shot transferred from another excel 2007 worksheet in the same workbook.
I'd like to remove the border line, I've tried right clicking... then format picture ...no dialogue box comes up. I've scrolled through all the commands in the ribbon + non ribbon commands and can't find anything that seems appropriate that's not greyed out ....
border line.docx
View 7 Replies
View Related
Jun 1, 2013
I have a TAB Named: Sheet18. I already set up the Header rows to print at the top of every page. Now I need to know how to set up to print the Footer at the Bottom of every-page the footer is A4804:Z4806, i need this rows printed at the bottom of every page when i print.
View 1 Replies
View Related
Feb 14, 2010
Using 2003, I'm trying to do the following, data starting in A3, and ending in L3:-
- If A3 is blank, cells have no format
- If A3 has a value, with A4 blank, fill is light blue and bottom line solid, top line dotted
- If A3 has a value, and A4 does too, fill is light blue, top and bottom line dotted
- If H3, which is a date field, is greater than today font is black, if less than today, font is red
View 9 Replies
View Related
Nov 9, 2006
I have a sheet that will be about 5 pages long if printed. To minimize wasted ink and paper, using VB I would like to be able to have it only print the portion uses (data entered) along with a section at the top and bottom. The section at the top would print on the top of the first page and the section at the bottom would print on the last page.
I know I could record a macro to select an area and print that but it would not do what I am trying to accomplish.
View 14 Replies
View Related
Jul 18, 2012
I have an excel sheet with lots of rows (it goes up to BAA) I would like to be able to print certain parts with a VBA
for instance if Sales is selected from a drop down (lets say A1) the macro will print
Area : C7:Z500
Scaling: fit to 1 page
Orientation: landscape
Color: Color
or if Sales next year is selected
Area : C7:D7 AA7:AZ500
Scaling: fit to 1 page
Orientation: landscape
Color: Color
etc....
View 9 Replies
View Related
Oct 2, 2007
I use the code below to print a portion of a sheet. My problem is that the area always changes. The $A$476 should be the first cell in that column that contains "HEA" The "536" in $F$536 is the last row that contains data. There are conditional formats all the way down to row 1,000 but not data
Private Sub CommandButton1_Click()
Dim strCurrentPrinter As String, strNetworkPrinter As String
****strNetworkPrinter = GetFullNetworkPrinterName("Adobe PDF")
****If Len(strNetworkPrinter) > 0 Then ' found the network printer
********strCurrentPrinter = Application.ActivePrinter
********' change to the network printer
********Application.ActivePrinter = strNetworkPrinter
********ActiveSheet.PageSetup.PrintArea = "$A$476:$F$536"
********ActiveSheet.PrintOut** 'print something
********' change back to the previously active printer
********Application.ActivePrinter = strCurrentPrinter
********ActiveSheet.PageSetup.PrintArea = ""
****End If
End Sub
Obviously there is a function also that finds the full network printer name, I didn't think it was important, because my issue is the print area. Everything else works fine. If you need it let me know and I will post it.
View 5 Replies
View Related
Feb 18, 2007
Looking for a macro that will set the print area on an accounts spreadsheet to the last non blank row, bearing in mind that all the rows contain formulas, have tried some macros but they assume the cells with formulas in them are non blank
View 4 Replies
View Related
Jan 14, 2010
I have made two line charts from a selection of data and added "shapes" to fill certain areas under the lines. Is there a way of doing this within the chart rather than adding a shape over the top?
View 3 Replies
View Related
Dec 1, 2011
What's the best way to shade in the area under a line graph?
View 1 Replies
View Related