Single Line Border Around A Cell - VBA

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


ADVERTISEMENT

Draw A Border Using Line?

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

Add Border Line Dependent On Condition

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

Macro To Set Border Line Styles

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

Change Line Border Color Of Shape

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

Bullet Point Each Line Within A Single Cell

Aug 22, 2008

My basic problem is I compile a newsletter for my company. Many people write me E-mails and i paste their "daily accomplishments" into a template. My question is if there is an easy way to insert bullets at the beginning of each line inside the cell. My company wants it prepared with a certain type. I am attaching a sample.

View 2 Replies View Related

Excel 2003 :: Border Line Styles Not Working

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

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 View Related

Excel 2007 :: Removing Border Line From Camera Shot

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

Concatenate Multiple Cells Into Single Cell With Line Feeds

Dec 21, 2007

I have one row per day of the month in column A. each row has one or more cell entries in column B .... to column (variable) Right now I use a formula =concatenate(B2,CHAR(10),C2,CHAR(10),D2.....) for as long as it has to be, but this has its limits and requires a lot of editing as the number of filled cells for each row vary.

would it be possible with some macro code to manage the variable number of cells and then insert verything, wrapped text, in a single cell (can be cell Bx or a cell in a new column added next to the dates column) As soon as everything is in the single cell, the original data cells can be emtied. I can record a macro but that does not allow me to manage the variable number of cells . a small sample file attached.

View 7 Replies View Related

Multiple Line Texts To A Single Line?

Mar 30, 2014

I have a multiple line texts I want to convert it in single line like for Example:

The following contents is to be converted in a single line

contents:

[aaaaaaaa] [bbbbbbb]......so on
[cccccccc] [ddddddd]......so on
[eeeeeeee] [fffffffffff]......so on

Result:

[aaaaaaaa] [bbbbbbb] [cccccccc] [ddddddd] [eeeeeeee] [fffffffffff]....so on

View 4 Replies View Related

VBA IF And THEN Statement On Single Line?

Feb 14, 2014

Difference between these two statements. The first one works perfectly while the second one returns an error. Also why is the best scenario to use IF and Then on a single line?

[Code].....

2nd one with error:

[Code] .....

View 14 Replies View Related

Multiple Vba Commands On A Single Line

May 19, 2008

Is it possible to have multiple VBA commands on a single line with a separator ( ; or , ) of some kind?

I am trying to keep my code as short as possible (from a scrolling perspective) and would like to have something like the following:

Dim MyArray(1 to 20, 1 to 3)
MyArray(1,1) = "Sheet1" ; MyArray(1,2) = "D8" ; MyArray(1,3) = "D9"
MyArray(2,1) = "Sheet1" ; MyArray(2,2) = "C49" ; MyArray(2,3) = "w3"
MyArray(3,1) = "Sheet1" ; MyArray(3,2) = "A23" ; MyArray(3,3) = "AB12"
MyArray(4,1) = "Sheet1" ; MyArray(4,2) = "Z19" ; MyArray(4,3) = "W12"
MyArray(5,1) = "Sheet1" ; MyArray(5,2) = "Q32" ; MyArray(5,3) = "Q23"

View 9 Replies View Related

Count Number Of Commas In A Single Line?

Mar 16, 2014

I am trying to count the number of commas in each line of my Excel file. So I first decided to count the total number of rows and then count the number of commas in each row. I wrote this code. But I keep getting an error saying Next without for.

Sub Give_The_Last_Row()
Selection.SpecialCells(xlCellTypeLastCell).Select
LastRow = ActiveCell.Row

[Code]....

View 1 Replies View Related

Data From Rows And Column To One Single Line

Nov 12, 2009

I have to worksheets: Sheet1, Sheet2. In sheet 1, I have some data like this (in first col is 1, second col is a, third col is c etc. ):

1 a b c d
2 e f g h
.
.
.
.

I need in sheet 2 in range A1(only in this range one big text), something like this: a,c,e,g ........ ( row1-col2,row1-col4,row1-col2,row1-col4 ......) ( separated by ","). The number of rows from sheet 1 is variable. The dataf a,b,c,d,e,f,g,h ... is some random text.

View 4 Replies View Related

Single Coding Line Into Multiple Using Underscore

Feb 10, 2010

Single coding line into multiple using underscore
How can i break this up

View 3 Replies View Related

Line Chart With Single Data Point

Jun 20, 2013

Showed a line chart using 2 vertical axis where the first was a single line along the graph (ie. 42%) then the second data series was a single data point that was above or below the line which easily showed if the result lied above or below the threshold.

How to get a straight line across the body of the just to be used as the theshold line?

View 1 Replies View Related

Copy/Paste With Single Line Using VBA (2007)

Sep 21, 2009

I had the following code that worked great with Excel 2003, but I receive an error with Excel 2007.

Dim Master As Workbook
Set Master = Workbooks("Master.xls")

For Each wb In Workbooks
wb.Activate
If wb.Name Like "S04*" Then _
If Not Range("A2") = Empty Then _
Range(Cells(Rows.Count, 1).End(xlUp), Range("A2")).EntireRow.Copy _
Master.ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1)
Next wb

I receive error 1004 "application defined or object defined error" when it tries to paste to the "Master" sheet using the the above lines.

Is there something in the formatting that has changed with 2007? I'm guessing I have to slightly change the line in bold.

View 9 Replies View Related

Add A Single Cells Contents To The LINE That Is Being Copied

Jun 10, 2006

I have some code (authored by Dangler) that i want to pull not just one range but also the contents of one specific cell and then copy the range and cell to a line on another spreadsheet.

Question:

f .Cells(i, 8).Value > 0 Then

.Range(Cells(i, 1), Cells(i, 200)).Copy

Sheets("all").Range("a65536").End(xlUp).Offset(1).PasteSpecial (xlValues)

End If

I want to add a single cells contents to the LINE that is being copied .... something like this...

f .Cells(i, 8).Value > 0 Then

.Range(Cells(i, 1), Cells(i, 200)) AND A1.Copy

Sheets("all").Range("a65536").End(xlUp).Offset(1).PasteSpecial (xlValues)


End If

the output would be like this: CELL CONTENTS, RANGE CONTENTS
or
K21, 40012122 400 450 450 50 001 BAGS

View 9 Replies View Related

Transfer Single Line With Sum Of Multiple Lines

Oct 16, 2007

I import data into an excel spreadsheet where a unique job number may have multiple costs against it. These import as separate lines, repeating the job number.

The data imports on a sheet called 'DataImport'. From that sheet I transfer some of the imported fields onto another sheet.

What I need to be able to do is transfer the job number and a sum of the costs onto the other sheet.

The data is run regularly and I delete all the fields on the DataImport sheet in the macro each time the import is run.

View 9 Replies View Related

Fixing Up Single Line Of Code To Format Column?

Apr 20, 2012

I'm trying to search for a column by looking for a specific column header and then format the entire column in the specific number format desired, but I keep getting an error message with this line.

Code:
With Rows("1:1")
.Find(what:="Go Live Date").Column.NumberFormat = "m/d/yyyy"
End With

View 2 Replies View Related

Write Array To Text File On Single Line

Apr 14, 2008

In VBA, is it possible to write to a text file, on 1 single line (without carriage return or line feed) the values of a dynamic array? For instance, I have the array:

Dim my(n) As Double 'n is changeable
my(0) = 0
my(1) = 1
my(2) = 2
.....

I want to write to a text file, like this: Write #filename, my(0), my(1), my(2) '..... until my(n) but n is changing

I want them on 1 line, because I use the other direction (up - down) for other things).

View 2 Replies View Related

Lottery Number Generation: Create A Single Line Function

Mar 29, 2002

You must install "Analysis TookPak-VBA" before doing this; check in your Excel's Tools/Add-Ins menu. Paste this long function (see below) in an Excel's worksheet (any cell) and press F9 (calculate) until you see at least 2 identical numbers. Real life's lottery does not have repeating numbers. I can disable this repetition by using cells relation but I want to use just one (1) cell. Any expert wants to challenge? If not, you can use VBA. But it still requires one (1) line of codes.

=RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)&" "&RANDBETWEEN(1,50)

View 9 Replies View Related

Excel 2010 :: Changing Cell Color And Border By Clicking A Cell

Apr 25, 2014

I would like to accomplish 2 things in my Excel 2010 spreadsheet by click a cell which already has a number and formatting in it.

1. How do I change the color of the cell, the color of the number in it, and the border around it. (Make it look like I just pressed a button by clicking it.)

2. At the same time have the text in different cell and the number in the selected cell appear in another different cell. (Text in a different cell = A , and the number in the selected cell = 23, the value in the resulting cell be "A 23") Everything I would like to happen at the same time by clicking the selected cell. I would also like this to be done several times by clicking different cells and not changing the previously selected cells.

View 1 Replies View Related

Cell Border Non-visible?

Jan 7, 2009

I have seen spreadsheet where the user has made the outline of the cell border non-visible. This seems like a fairly simple task, but I can't seem to find out how you format this type of border.

View 2 Replies View Related

Cell Border Disappearance

Dec 19, 2009

When I enter data (digits) into a cell, its left border
becomes thinner ! Where is the connection between format and content ?

View 14 Replies View Related

VBA / Special Border Cell

Oct 11, 2013

I am trying have the macro go from H7:H300 and if the value in the cell is "Grand" the I need it to border the top, right, and bottom. Not the left side and then keep going until all cells are checked.

View 1 Replies View Related

BORDER Around Active Cell

Dec 4, 2006

I have a spreadsheet with DDE formulas in the cells. When the contents of any cell changes I want to DRAW A BORDER (NOT CHANGE THE BACKGROUND COLOR !!) AROUND THE CELL .. When another cell's value is updated I want to REMOVE the border which was around the"OLD" cell and now place a border around the most recently changed cell, etc.

Only the newest active cell should have a border around it !!!

View 9 Replies View Related

Changing Colour Of The Border Of A Cell

Nov 24, 2008

How can I change its colour? Every time I try to it reverts to the automatic black. I do not want to change the automatic colour (not that I know how to) because black suits me for most of the cells; but there are some where I want a blue border.

This problem arose in conditional formatting but applies to ordinary formatting too. It occurs in 2007 and 2003.

View 2 Replies View Related

Code For Cell Border Styling

Jun 1, 2008

I have an excel sheet that is pulling data from other sheet based on some cretaria...i want a macro that when ran on this excel fixes column width , makes cell border as "dotted" and outline the area with Thick Outline.

This is what a macro code should do ; Hope this makes sense...thanks.
1. Finds numeric values in rows falling in colum B,C,D,E , than border those cells as dotted (i.e. right click on cell - format column - Border - Style - 3rs on top left row).

2. After filling cell border style as mentioned above , macro should do a THICK BOX BORDER around a cells falling above dotted cells.. i.e. one big sqaure outlined contaiing dotted cells with numeric values.

3. Trick part , my sheet is divided into 2 parts , INTERNAL and EXTERNAL. So i have writen "INTERNAL" in A1 cell and EXTERNAL in 'A' row in last row after INTERNAL lines. So the THICK BOX BORDER as requested in pt 2 shud be separted ones for INTERNAL and sep from EXTERNAL.

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved