Macro To Draw The Cell Border
Since I did not know how to do this I used the record macro cheating option.
Excel spit out this chunck of
View Complete Thread with Replies
Related Forum Messages:
Macro To Draw Colored Circles
I've recently come across this wonderful site and have found it to be a pool for great information. I looking for some assistance with finding a macro that will draw circles/dots on a worksheet when the left mouse button is clicked at the mouse cursor location. There may be something out there already??? Here's exactly what I need; I want a macro that will draw 7 different coloured circles (blue, pink, cyan, lime green, red, yellow, and orange) on a worksheet. The macro would be activated from a button (7 different buttons- one for each colour) on the worksheet and when the left mouse button is clicked the coloured circle is drawn at the mouse cursor location.
Macro To Set Border Line Styles
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.
Background Color And Border Around Macro
I am trying to develop an Excel spread- sheet by using some macros. In detail, in my first worksheet, I have something like -
This rows are coming from another worksheet and I have used a macro (developed by me) to populate these rows. Even the number of rows to be populated is not fixed.
However, I would like to add one row with text - " Total Expense" after those rows. This row will have some background color - say Tan - and font color - say Green - and also a border around its own - in nature, the border will be thick, Double and with color Rose. I have tried the following code in macro but not working properly -
Sub Include_Fields_n_Format(loc As String)
tot_exp_scell = loc & f_scell
tot_exp_ecell = loc & (f_scell + 1)
Range(tot_exp_scell, tot_exp_ecell). Merge
Range(tot_exp_scell, tot_exp_ecell).WrapText = True
Range(tot_exp_scell, tot_exp_ecell).Interior.Color = RGB(150, 150, 150)
With Range(tot_exp_scell, tot_exp_ecell).Font...................
Create A Border Macro When Open The File
I have recorded a macro which will create the border for me when the file is opened, but it turned out too long. if someone can show me how to reduce the codeing. I have the attached file.
Range A5 to E20 thin Border all sides and thick border allround (16 rows)
Range A21 to E36 thin border all sides and thick border allround (16 rows)
end range is A356.
BORDER Around Active Cell
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 !!!
Cell Border Non-visible?
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.
Code For Cell Border Styling
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.
Cell Border And Colour With Text
I have a sheet which automatically adds entrys to the sheet depending on what team they are on, all i really want to do is colour and border to the last row only, i know this should be able to get done in conditional formationing some how but im unsure.
I have got it in some of the cells with text in, but the ones with numbers in remain the same, if i can remember i used con formating and done, if the cell value is greater than <> then my formating, but numbers remain the same.
Automatically Format Cell Border
I am trying to Formal my Cell Border automatically.
Lets say i have cells
These are single cells running downwards only. I want to format this 6 cells into 1 box using (outside borders) formating. I need to repeat this for every 6 cells into 1box...and continue on and on. Im doing this process manually...But i got like 100,000 cells...
Changing Colour Of The Border Of A Cell
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.
Format Border Based On Cell Content
I have a dynamic table (rows regularly added or deleted) that is generated automatically based on choices made by the user in another worksheet. I need a function that will examine all the cells in one column, and when it finds a difference between two cell entries, it will change the border between these two entries to dark (medium weight), and then extend this border across the table. The end result should be that wherever the cell contents differ within a column, the table is divided by a darker border across the entire row.
Bottom Border Depending On Matching Cell Value
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"
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
Cell Border Not Moving With Cell When Sorted
how to filter rows of data, in ascending or descending order, whilst still retaining formatting (in my case cell borders) and conditional formatting?
At present, when I filter rows in ascending / descending order, the cell formatting & conditional formatting stays in it's original position, rather than moving with the cell. I can't find a way to resolve this.
Double-Click Cell Border Jumps To Other Cells
I'm trying to double-click a cell to edit the contents, and I am off a few pixels, it treats the double-click as a double-click on the cell border, not the cell contents, and the focus jumps to another cell in the direction of the border instead of going into edit mode. The effect is as if I had pressed Ctrl and the arrow in the direction of the border I clicked on.
The only way I've found to disable this is to turn off the option "Enable fill handle and cell drag-and-drop", but unchecking that also disables actually useful things, like dragging the corner of a formula call to copy it down, etc.
Is there a good way to disable this cell jumping when I accidentally double-click a cell border?
League Cup Draw By Using VBA
i want to make a cup draw, but i don't want to use RAND, I want to use VBA.
What i want is to make a English Football League Cup, so all 92 leagues teams are in it, but as follows
First Round 72 teams
Second Round 50 Teams
Third Round 32 Teams
Fourth Round 16 Teams
Quarter-Finals 8 Teams
Semi-Final 4 Teams
Final 2 Teams
for a team list see attached excel spreadsheet
If you are not sure what i mean google search English League Cup or try soccerway
I want a command box or similar for each round, i dont want it to change unless i click on the command button again.
i will be inputing the scores myself.
Sorry i forget one team in the First round "Darlington"
I was looking for some code to randomly generate a number for a prize draw I am doing. I found a great piece on this site, which I have slightly changed to give me what I have below.
It works great except for one thing I cannot work out, I have the code below working on cell "C1", I would like it to work in cell "C5", but I can't seem to work this out.
Dim w As Long, x As String, y As Long
x = Format(Int((Range("B2") - Range("B1") + 1) * Rnd + Range("B1")), "0000")
For y = 1 To 1
For w = 1 To 250
Range("C" & y) = Int(8000 * Rnd)
Range("C" & y) = CInt(Mid(x, y, 4))
Also, whilst here. i will have one other problem, with it being a prize draw I do not want to draw the same number twice. At the moment I have a small macro that copies the winning name that appears on the main screen (via a vlookup) onto a winners spreadsheet. I am thinking of then creating another macro that replaces the winning name on the master list with an "Already Won" entry, so we can just select again.
Combinations - Win Or Draw
I'm creating a spreadsheet regarding football teams and want to lis thte combinations of results for each team.
Specifically, if the team will win or draw.
So, I have 6 teams, each team can either win or draw.
I want to display the combinations of team 1 winning AND team 2 winning AND team 3 winning etc.
How To Draw A Line In Userform
I have a 5-column listbox in a userform. I do not know how to make the column borders visible. If somebody can tell me, that would be great.
If not, then the next alternative would be to manually draw a line. I tried to so one, by creating a Label with a width of 1, and backcolor ot black. This works but not in front of a list box. For some reasons it cannot be brought to front/forward (order) of a listbox, I already right-clicked several times and sent tthe order to front.
Is it possible to bring it in front of a listbox?
Randomize List For Competition Draw
I'm running a Secret Santa DJ competition this year and today now wish to make the draw.
Basically all entrants send in their mixes (in this case - upload to a webserver) and I then wish to try and use Excel to make the draw.
What I'd like to do is have a list of all the entrants in column a, use RAND() in column b to assign them each a number, and in column c use the list of entrants in column a to assign each person a mix to receive.
Through my browsing and searching on here, I came across the following (entered as an array); it's brilliant but unfortunately gives me duplications.
Calculate Draw Down. Futures Trading
way to calculate the drawdown for a futures trading account’s equity. The following is the record of taking a sequence of 20 trades. Drawdown is defined as the lowest point between two consecutive equity highs. Therefore a formula should detect pairs of equity highs and then find the maximum difference between these highs and the lowest point in between each of these pairs. Do you think this can be done using standard excel functions?
You might wish to plot a linear graph to visualize the equity. Looking forward to hear what you think! I include more examples of equity records.
formal definition of a drawdown:
Drawdown: The magnitude of a decline in account value, either in percentage or dollar terms, as measured from peak to subsequent trough. For example, if a trader's account increased in value from $10,000 to $20,000, then dropped to $15,000, then increased again to $25,000, that trader would have had a maximum drawdown of $5,000 (incurred when the account declined from $20,000 to $15,000) even though that trader's account was never in a loss position from inception
Rankings Draw Sheet For A Tournament
I have a worksheet set up as a draw sheet for a tournament. I have a set of rankings showing all points collated from last tournament. What i want to do is set up a formula/macro so that a cell containing a player eg. the winner will be found on the ranking list and the points won will be added to the next cell on the ranking list.
Draw Parallel Line Through Scatter Plot
Currently we have data that is plotted to a scatter plot along with an already defined line. Next, with a straight edge we attempt to draw a line parallel to the already defined line through the scatter points of data. We basically find two points that give us the best fit to the original line. What I attempted to do was calcualte the slope of the original line and then the slope of each combination of two points in the data set. I then subtracted the slopes, found the minimum difference and thought that would give me the line most parallel to the original. This doesn't seem to work. I'm at a loss, any advice?
Can Draw Shapes Or Angles Based On Data
Can Excel Draw Shapes or Angles based on Data?
I have a radiation Excel file that solves for Radiation intensity using Distance and shielding as reducing factors.
Similar to a circle of light being less intense with distance so is radiation.
I need excel to draw a circle from a point specified based on a value I give.
For example at 1 ft I might have 500 R in 1 hour (life threatening!)
At 16 feet I have about 2 R in 1 hour (not safe for too long)
These circles would be overlayed on an map.
I would like to draw a new circle at various distances, simialar to a bullseye.
I would also like a triangle drawn based on angles and SIN / COS / TAN formulas
Could this be done in VB or preferably without.
App To Draw Curved Shape To Scale With Drag & Drop Capabilities
I am researching the possibility of using Excel 2003 WITHOUT a Cad or Drawing package to simulate a drawing. (Consultants inquiries are WELCOME). The idea is to prompt the user (Sales Rep or Customer) for a few key dimensions and then plot out a closed curve based on the coordinantes entered. This shape, which would need to be accurately scaled, would then be sectioned and used as a canvas for dragging and dropping various icons.
Why use Excel instead of CAD?
Other than "everyone" having it, the placement of the "icons" relative to the perimeter of the curve will be used to estimate material costs and generate a quotation like a configurator application.
Key hurdles seem to be the drawing of a curve with cells as pixels and using drag & drop with custom icons - possible as an Add-In?
Border Around Cells With Same Value
Below a small example with the borders as they should be. How do i get a macro to put the borders automatically, depending on the similarity of the cells in column B ? Note the blanc column with the borders should be made automatically as well. Second problem: the minimum height of a "border" should be 34pixels as in the example so you can write something in there after printing the sheet.
VBA To Know What Kind Of Border It Is
Does any know of excel code to know what know what kind of border it is. I converted a pdf file and now the data are on excel and there are borders and it looks to me like it is border with thickness of medium but when I run a code I produced and mark X to the column next to it to show that it is that border it gave me X on all the rows and so the medium thick border is excel grid without any borders.
Border Around Duplicates
I have a list (approx 2000 rows). I'd like to put a seperate border around any duplicates that are in the fourth column. If there isn't a duplicate then the regular gridlines are fine. I'd only like the first four columns to include this border. Is there a way for excel to automatically place borders around duplicates? Here is an example of what I have and what I would like it to look like.
Add Border Around Selection
There was also another bit of code which added a border around the selected text.
It got stuck on this:
.LineStyle = xlContinuous
.Weight = xlThin
.ColorIndex = xlAutomatic
The problem was that there was no Inside Horizontal if there was only one row. I had to chage my code to include a header as well as any selected rows - giving me the two row minimum required. This does the job for now - I'll have to give it some thought on how to get around the problem without the extra header though.
VB Border Color Code
part of my code looks like this. Instead of it being if c.interior.colorindex i want it to be if top border color = 4.
How do i syntax this?
For Each c In Worksheets("Sheet1").Range("B7:DE7").Cells
If c.Interior.ColorIndex = 4 Then Range("DH7").Value = Range("DH7").Value + c.Value
Also, is there a way to specify Range("DH") and make the row be the current row, not hard coded to 7
Insert Border When Data Changes
What I'm really looking for is to box in data as the data changes using the border feature.
Column A would contain the data to look at however there may be additional data in columns B, C, D and so on that would need to be "boxed in" with the group of like data.
I can't get the HTML to work so we'll have to go sans spreadsheet on this one.
Conditional Format (Border)
I'm trying to conditional format a cell that contains a formula that when the formula returns anything other than "" the cell contains a border.
My formula within the cell is referencing another worksheet
Ideally the formula within the conditional format would be
but it isn't possible to reference another worksheet within a conditional format.
Page Border Like Word
Is there any chance to draw page borders in excel like ms word
i have huge data around 450 pages for which i want to set page border
as per my knowledge i have to select each page and set the border
which is taking lot of time.
instead of this is there any option to set page border
Find Border Using Xldiagonaldown
Is it possible to use a FindFormat to find a Border(xlDiagonalDown)?
If so can you please show me the code to do so.
Dim e As Range
Dim r As Range
Dim c As Range
Dim lCount As Long
Dim strFirstAddress As String
Set e = Range("A1:A6")
.Bold = True
.Italic = True
.Size = 16
Vba, Separating Ranges With A Border
I have a spreadsheet of data, and all entries are grouped by different unique reference (three digit number). I need something in VBA so if the the unique reference in the columns are the same, to place a border over the ammending data. The actaull; spreadsheet is sorted ascending by the unique references so all the entries are already grouped together. EG - So if I ran the code it would put a border around the group of rows for unique reference 126.
I attempted using if activecell offset, but i dont think the logic works. I ran a macro for the border, it is below.
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
Border Last Range Of Cells
I am trying to have a border drawn around a group of cells. This group of cells changes per list I make, but only the height changes. The width is always the same (from column A to column J) and the top is always at row 5. Only the last row changes. How can a border be drawn around this group of cells no matter the size of the group of cells? Below is the macro I have written so far.
Rows("2:2").RowHeight = 49.5
lastrow1 = Range("A65536").End(xlUp).Select
Range("A5:J" & lastrow1).BorderAround.Weight = xlThin
lastrow2 = Cells(Cells.Rows.Count, "C").End(xlUp).Row
For I = lastrow2 To 2 Step -1..........................