Select Last Row And Format Borders
Apr 29, 2009This piece of code is run from a form when the user click OK. It dumps the data the user filled in on the form, below the last row on the sheet.
View 2 RepliesThis piece of code is run from a form when the user click OK. It dumps the data the user filled in on the form, below the last row on the sheet.
View 2 RepliesIs there a way to format any row in the workbook based on text value in VBA?
e.g. If I type "BLANK" in any row of a worksheet, then the certain cells in that particular row will Format Borders xlDiagonalUp (D:G,K).
I am trying to use VBA to select all sheets and then format
Wrap Text
Freeze at A2
Column Widths
I tried the following code but it is just formatting one sheet.
Sheets(Array("New", "Closed", "Open", "Open_Beg_Month", "Closed WAD")).Select
Range("A2").Select
ActiveWindow.FreezePanes = True
i want to type 1-1 in my excel sheet and it is automatically coverting to 1-Jan and then i checked for formatting to the way i want then i founf excel automatically selecting custom option in format then if i select general my 1-jan is converting to 41640 number. Now i want excel sheet should show what typed in it i .e. 1-1 only.
View 2 Replies View RelatedI am trying to find the last cell with data in a spreadsheet once this has been found select all up upto cell A4 and then format these cells into number format to zero decimal places so far I have the following which finds the last cell:
LR = Cells(Rows.Count, "A").End(xlUp).Row
Range(Cells(LR, 1), Cells(LR, "A")).Select
I need a code that will copy the format AND formulas of the entire row that I have selected (or activatedwith my cursor) to each and every blank row - until it gets to the last row of data on this spreadsheet.Since any employee could have more than 1 row of data - I am using a code that inserts1 blank row after each NEW employee name.
NOTE: This report is initially sorted by employee name so that each occurrence is grouped together.REPORT SPECIFICS:1) This report reflects typical paryoll information.2) Certain columns have data that is either in text, general, or number ($) format3) The number of columns may vary depending on which PR report is being worked4) For the sake of simplicity - we can assume that the column titles will always be across row 15) Each employee name on this report may repeat several times depending on how many weeks they worked,so the SUM() formula should adjust automatically to capture all the rows of data to add up for each employee
HERE IS MY SPREADSHEET:
texttexttexttexttextformulaformulaformulaDeptDivEmployee NameEE#Period EndHrs WorkedPTOAccrd LiabilityCSDINSEWilma Wilsont4561/7/1280.5$ 100.00 CSDINSEWilma Wilsont4561/16/12121$ 200.00 CSDINNECage Nick2581/7/1281$ 600.00 CSDINNECage Nick2581/16/12245$ 25.00 CSDINNECage Nick2581/23/12323$ 25.00 CSDINWPolly Cracker1781/7/12856$ 60.00 CSDINWPolly Cracker1781/16/12242$ 654.00 ARVIPWPolly Cracker1781/23/12322$ 2.00 ARVIPWPolly Cracker1781/28/12161$ 5.00 ARVIPWPolly Cracker1782/6/1284$ 3.00 CSDINSEDim Sum6871/7/1284$ 65.00 CSDINSEDim Sum6871/16/12126$ 5.00
HERE IS MY CODE TO INSERT 1 ROW
Sub InsertRowAtNewNameONE()Dim LR As Long, i As LongLR = Range("C" & Rows.Count).End(xlUp).RowFor i = LR To 2 Step -1If Range("C" & i).Value Range("C" & i - 1).Value Then Rows(i).InsertNext iEnd Sub
NOTE: See below: I will format and add formulas where I need on the 1st blank row that was createdand I need a code that will copy this particular row to all blank rows to the last.
recordtexttexttexttextcountformulaformulaformulaDeptDivEmployee NameEE#Period EndHrs WorkedPTOAccrd LiabilityCSDINSEWilma Wilsont4561/7/1280.5$ 100.00 CSDINSEWilma Wilsont4561/16/12121$ 200.00 2201.5$ 300.00
I have a spreadsheet containing data in coloumns A to L.
Where all the codes in column B are the same then a border must be placed around all the codes that are the same i.e the border must start in Column A and end with column L.
provide me with the code the will put borders around the codes in column B that are the same ...
I have created a 4 page chart in landscape with text in each of the 4 columns in the chart.
When I looked at it in print preview the chart did not fill the page and so to widen the last 2 columns I dragged them over to the right hand margin. I am still definitely within the right hand dotted line showing the margin limit.
The problem is that I cannot now put a border line down the extreme right hand column. Every time I click on any of the border instructions in the Font tab nothin appears on the right hand side of the box.
I am trying to write vba code that will highlight the row in the range if a field is over a certain percent. The column number won't change but the number of rows will. I'd also like the code to automatically work on all tabs of the workbook when a button is clicked.
Data Info:
Currently there are 4 tabs, but can have more/less
Columns used are A:O
Data for shading starts at A3 and should go to however many rows have data and ignore blank rows
Formula should be if data in column E is over 10.00% then the data in that row A:O should be shaded in the color off yellow & have black thin orders
If the data in column E is not over 10.00% then the data in that row should not be shaded but still have thin black borders.
Is it possible to stop excel from pasting border formating with cell data other than to select paste special-all except borders?
View 5 Replies View RelatedThe attached file works with 3 Drawers and 3 Doors but if I use 2 Drawers and 2 Doors the Borders do not line up. I think the Drawers are right the Doors appears to be the problem.
Same thing happens with 3 drawers and 4 Doors. It has and extra border on the right side.
See Attached : ozgrid cabinet error.xlsm
Also I would like for the Measurements to be in the cell to the right of the left hand border and center across each of the sections.
Change B3 and B4 to 2 then click draw. 3 and 3 work 3 and 4 don't but 4 and 4 does.???
I want to remove some cell borders for printing so that on paper it will look like 2 separate tables (ie, I want a space between the 2 tables). I have tried removing the borders and changing the colouring to white but they still show.
View 5 Replies View Relatedi am trying to do the following but having trouble getting my head around it!
if a2=0 then b2:b13=border
I need to change the thickness of the borders line but I couldn't find out how.
View 6 Replies View RelatedWhat I'm trying to do is put top&bottom borders on ALL cells in a range, not just the margins of the selected area. See spreadsheet below for explanation if required.
Surely there must be a way to do this through Excel menu, tools and whatever.
Alternatively, this could be solved if I knew how to select all rows in a spreadsheet (not Select All), because if I select rows one by one it will obviously apply the borders correctly. Is there a way to select multiple rows then?
A cell on sheet1 needs to count the number of cells on sheet2 (D3:D31) that has a complete (top, bottom, left and right) border. This is my best shot at it.
[Code] .....
Sheet1 cell I input =CountBrds('sheet2'!D3:D31)
One issue, on sheet2 for example cell D4 is merged with E4 and F4 as is every even cell in the D column down to row 30. Not sure if that throws a wrench in things or not.
Trying to select all cells below the last row of data based on column B and remove borders.
So far I have this.
[Code] .....
I am using a user form to display a splash screen. In the user form, I have a picture that is being displayed as splash screen for 5 seconds and then it disappears.
I only want to display the picture in the splash screen.
I want to to remove the following three items from the user form:
1 - remove all borders
2 - remove the menu/caption bar
3 - remove the "x" button that allows user to close form.
I have a spreadsheet that has descrptions in column D. Where the descriptions are the same ,
I need the VBA code that will do the following:
1) Sort the data by columns C (descending), G (ascending) & E (ascending)
2) Putting a border around all the data where the decriptions are the same
i.e from column A to Column I beginning from row 2
I have attached a sample file for ease of reference....
i have just recorded a macro to put thin borders in columns L and M, but it needs cleaning, ...
View 9 Replies View RelatedI have designed a form with Grey horizontal borders.
When I print to my HP LaserJet 2420, the borders are black.
I have other forms with Grey borders where the borders print Grey.
I have not chosen to print Black and White in Page Setup.
How do I correct this?
With Range("A12", Range("E65536").End(xlUp))
With .Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeTop)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
End With
With .Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlThin......................
It is supposed to border data from columns A to E for all rows where data exists in column A. (like a dynamic range). How would I change the dynamic reference I have now?
I have a report that is imported into excel with all thick borders. Does anyone know a VBA code (or simpler way) to change all of these borders to skinny borders?
View 4 Replies View RelatedSometimes when i run code under a command button on a pop-up user form, the contents of the userform go "blank (i.e., border stays on, so you can see that the form is still there, but the contents are all "white"-you cannot read/see any of the content...
What could be done to prevent this from happening (presently, i just have the mouse cursor displaying while code is running?
How to box data where the bottom of the box ends at the page break.
View 1 Replies View RelatedI am using a user form to display a splash screen. In the user form, I have a picture that is being displayed as splash screen for 5 seconds and then it disappears. I only want to display the picture in the splash screen. I want to to remove the following three items
from the user form:
1 - remove all borders
2 - remove the menu/caption bar
3 - remove the "x" button that allows user to close form.
In column A of my worksheet I have values starting from A4 as below:
A4-1000
A5-1000
A6-1000
A7-2000
A8-2000
A9-1500
A10-2200
A11-2200
A12-2200
A13-2200
and so on till A10200.
What is want is to put thick box borders for similar values using a macro. For e.g. i want to put the borders to first 3 cells together as these are of same value 1000, then it has to be put to A7 & A8 (Value - 2000), then for A9 alone, then for A10 to A13 together till i have values in column A.
I am having a hard time understanding why the following code (i am avoiding the select procedure on purpose) doesn't work:
Code:
Function APMS_Border(Namesheet As Variant, Mode As Variant, RowStart As Variant, ColStart As Variant, RowEnd As Variant, ColEnd As Variant, LeftBorder As Variant, TopBorder As Variant, RightBorder As Variant, BottomBorder As Variant, InterColor As Variant)
Dim BorderMatrix() As Variant
[Code]....
it only draws the left border of my range, am i missing something?
I got some code from an old discussion thread
Sheets("Reference").Select
Range("d9").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Dim myBorders() As Variant, item As Variant
myBorders = Array(xlEdgeLeft, _
xlEdgeTop, _
xlEdgeBottom, _
xlEdgeRight, _
xlInsideVertical)
This ia a recorded code to draw borders around cells on a given range
I am sure it can be shortened to 1-2 sentences!
Range("J11:O16").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic