VBA For Adding Borders To A Range Based On Condition?
Jul 12, 2009
I have a spread sheet I use to track tools. One tool may be checked out / returned several times a week. When I do custom sorting I end up with the Tools listed neatly by date and number. EX: ...
View 10 Replies
ADVERTISEMENT
Jul 28, 2007
Error 1004 on the 5th "With Selection" Chunk, .LineStyle part.
What I did is recorded the formatting I wanted on a selected region, then changed the major references to the defined region in my code called rngATotals.
At first I got errors with the "Select" method of the "Range" class with my rngATotals line (the first one). But then I clarified public variables and now its in the formatting chunk that was recorded.
I've tried:
--Changing security/protection settings
--Clarifying my rngATotals references
--Making the sheet containing rngATotals visible (still in my code snippet)
--And not using rngATotals to define my range but more specific, clunky references like Range ("A3":"B7") or Range(Cells...,Cells...) or Range ("RAnge'sName")
What further could I clarify? And why does it have a problem with the 5th borders/linestyle reference and not the previous ones?
I hate to have to ask another question about this error because there are so many...
Is there anything beyond what I've tried that is a usual way to approach this problem?
Anyway heres the
Sub FormatTotalsTables()
'
' FormatTotalsTables Macro
' Macro recorded 7/22/2007 by AEB
SumSheet.Visible = True
rngATotals.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
With Selection.Borders(xlEdgeLeft)
View 9 Replies
View Related
Mar 14, 2014
I have a file in which I have data from A9:I50.
In the column C i have the type mentioned either MTC or SELF.
If the value in column C is SELF then I want to highlight the corresponding rows from A:I.
[Code] ......
This code is colouring the entire row.
I want it to be highlighted from A to I.
View 2 Replies
View Related
Nov 26, 2013
What 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?
View 5 Replies
View Related
Aug 16, 2006
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?
View 5 Replies
View Related
Dec 4, 2009
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
View 9 Replies
View Related
Apr 17, 2008
"copy cell range based on conditions" and it didnt really get an answer. There was one that copied the info the next blank cell on that line, but im not smart enough yet to figure out how to copy it over. ( getting there though with lots of staring at code).
2 sheets. I have already created auto modules to fill in data and code,and sorted the columns so they are in line.
Sheet 1. Info : has 9 columns. So if column = 9 and the value = new.
Then i want to copy the range on the columns (A:G) and then paste it on the other sheet ( Card info) as long as Column A is empty ( as in next available blank cell) ( something like a DO while worksheet("Card info").column(A) <> ""
View 9 Replies
View Related
Jun 9, 2008
Is 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).
View 5 Replies
View Related
Oct 19, 2012
I'm looking for the least amount of code to apply a border around every cell in a selected range. The standard With Selection approach is to go through six times for the sides, top, bottom, and insides, which results in a lot of code.
I attempted a single code line approach (Selection.Borders.LineStyle = xlContinuous), but I cannot seem to influence the color or thickness of the line. I'm not looking for fancy here...standard xlThin in black color is all I need.
View 3 Replies
View Related
Oct 2, 2012
On this is a column of Categories and a Column of sizes. I want to use these in a user form. The user will select their Category from a drop down list and the second drop down list will include only the sizes that appear next to the chosen category So for example in the attachment if the user chose 'AUD' as a category they would get the size choices of, '2x4 insert', '2x4 replica' and 'A4L' in the other drop down menu.
The master list of sizes will have to remain on a worksheet as this is what other operators will amend from time to time.
View 1 Replies
View Related
May 6, 2014
I have the following which works just fine
=SUMPRODUCT(--(Table_owssvr[Migration Slot]>= (ActualMigrations!D$3-6)),--(Table_owssvr[Migration Slot]<= ActualMigrations!D$3),
--(Table_owssvr[Department]= $A6))
If I then add a condition ie
=SUMPRODUCT(--(Table_owssvr[Migration Slot]>= (ActualMigrations!D$3-6)),--(Table_owssvr[Migration Slot]<= ActualMigrations!D$3),
--(Table_owssvr[Department]= $A6), --(Table_owssvr[Is_Migrated]="TRUE"))
It returns nothing even though the Is_Migrated is TRUE
View 8 Replies
View Related
May 12, 2014
I'm currently using the following function: =COUNTIFS(Data[Quarter],"Q1",Data[Country],A3,Data[Sales],">2000") which works perfectly. However I'd like to add another condition "between 1000 and 2000".
I've tried this but I'm not getting any luck: =COUNTIFS(Data[Quarter],"Q1",Data[Country],A3,Data[Sales],AND("<1000",">2000")).
View 3 Replies
View Related
Mar 28, 2014
I have a code that searches in a column for a certain value, if it finds it, it copies this value to a range adjacent to it.
[Code] ..........
However, if the cell where the code is supposed to find a new value is blank it makes the range blank. But in that case, I wan't it to leave the range cells with their original value.
View 11 Replies
View Related
Jun 29, 2006
I have this formula in my spreadsheet =IF(ISBLANK(B2), "", C1+1). I need to add a "dash T" to this formula so it shows up in every cell. How and where do i write that into a formula?
View 2 Replies
View Related
Jan 8, 2014
Below is my function.
="Profit $"&SUM(IF(Sold!D15:D8998<>"",IF(MONTH(Sold!D15:D8998)=A4,Sold!H15:H8998)))
I would like to edit this function to also count profit only if Cell A15:A8998 in my Sold sheet has the words "Shipped". The text value Shipped is not a text value I entered, it is automatically written based on a Vlookup formula I created.
View 2 Replies
View Related
Aug 28, 2009
Title: How do I add a condition to an IF and Vlookup Formula:
I need to edit a formula to include a condition. I attached an excel file for ease of explaining the problem. I want to say if $E$5 has “A to B” then F5 will automatically have BOR, but if E5 has anything else then the Vlookup formula applies.
I was thinking something along this formula:
=IF(AND($E$5<>”A to B”,ISBLANK($B5),"",VLOOKUP($B5,'Drop Down'!$D$1:$E$500,2,FALSE)))
I know I need to add “BOR” in the formula above somewhere
Where am I going wrong?
View 2 Replies
View Related
Nov 17, 2009
=IF(SUM(Q4)=0,"",MAX(0,G4-MAX(F4,Q4))/7) - to calculate number of days for year
=IF(SUM(TODAY()>G4),(G4-MAX(F4,Q4))/7,SUM(TODAY()-MAX(F4,Q4))/7) - to calculate number of days year to date
I am using this condition to calculate the length of a service which falls with in a specific review period, eg
Service starts 1 Feb 09 and finishes 30 April 09
The review period is 1 Mar 09 and finishes 31 May 09.
I would need to measure the number of days that fall within the review period, which would be 1 Mar 09 - 30 April 09
At the moment I am missing a condition which identifies whether to subtract from 'service end date' or 'review end date'.
View 6 Replies
View Related
Mar 10, 2014
I'm preparing Quarterly Evaluations, and am having an issue because an Analyst has superseded an overall percentage goal. In the attached example, it is the overall evaluation with the 'problem data' in red D19 and highlighted.
I'd like to add a condition that limits the points in D19 for 'responsibility 3' to 150.
=IF(ISERROR(C19/B19)*(B10),"-",(C19/B19)*(B10))
*just a note for clarification, the other two responsibilities are a 'per hour' weekly goal, whereas the 3rd is an overall personal effort divided from the overall team effort.
View 4 Replies
View Related
Jan 22, 2010
Adding condition to SUMPRODUCT causes result to go up? (2007). I have the following formula:
View 5 Replies
View Related
Oct 6, 2011
I am using the formula below to count the occurences of relevant text strings (names) in a cell that can contain many separate strings. It works great. "References!$F$2:$F$34" contains my list of names and the formula returns how many occurences there are in each cell.
What i'd like to do know is work in a date criteria. Each name has an associated relevant date attached to it as does each cell that I am looking for these names in.
So...in english what Id like to do is alter my formula so that when it finds a text string that exists in "References!$F$2:$F$34", it then compares the associated date in "References!$G$2:$G$34" with the date associated with N3 which happens to be O3.
SUMPRODUCT(COUNTIF(N3,"*"&References!$F$2:$F$34&"*"))
View 5 Replies
View Related
Dec 17, 2011
I've done this before but can't remember how I did it:
1BCDEFGH21234533red92701131096601005096604green20070582305250044940472805
blue0355203912033930389706bpink51059230632205352061280789-In column H,
I want to sum only rows that are less than or equal to cell H2.....
View 2 Replies
View Related
Apr 12, 2014
So I have one sheet that needs to pull data through to another sheet (which is a stats summary)
I have a drop down list containing 4 options all of which have to be counted separately on the stats summary sheet. However I only need them counted when a value is input in another cell in that row.
For example: I select option 1 from down down menu, but I only want this to be counted on the stats page when I enter a date in the "date" cell.
View 9 Replies
View Related
Aug 22, 2013
The issue is the I want to put the condition here in my the code that only copies the desired cells if the sheet is named specifically such as "Jan", if not named as this the worksheet should not be used. The current code I am using was posted on this site in 2009: VBA to copy specified cells from all the files in a folder
My modified code is:
Option Explicit
Public strSourceFldr As String
Public EachFile As Object
Public objFSO As Object
Public objFolder As Object
Public objFile As Object
Public strSheetName As String
[Code] .........
View 1 Replies
View Related
Oct 4, 2006
I would like to apply different conditional formatting at different times with a click of a button. I setup a dummy and turned on the recorder and recorded this
Range("A7:N7").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$C7=1"
Selection.FormatConditions(1).Interior.ColorIndex = 37
Range("A1").Select
End Sub
I tried changing to this
'/Conditional Format - OTHER EXPENSE B/L
Set rngConditional = wsData.UsedRange
With rngConditional...............
View 9 Replies
View Related
Dec 15, 2009
I want to total column C, but only where column B contains certain data, like add column C where column b contains abd so that i get the answer 7, Hope ive explained it right.
B C
abd 1
abd 2
bmr 3
abd 4
crc 2
crc 3
bmr 2
View 2 Replies
View Related
Mar 22, 2009
I have a column called Average and it have numbers from 0 to 100. I want to set a string on another column based on the value of Average. The condition is
< 50 is negative
= 50 is neutral
> 50 is positive
For example
Column A Column B
45 Negative
50 Neutral
80 Positive
View 4 Replies
View Related
May 4, 2009
I want to insert a line wherever I encounter a number. I have a range of cells in column "A" with invoices listed and at the end of each customer I have the total. At the total line (the number) I want to insert a line. Right now I can't figure out how get the cell value to recognize a number from a non-number data type (bolded area)
View 5 Replies
View Related
Aug 12, 2009
I would like to write a code, that can check the name of cell A1 with A2.
If A1=A2, then insert a blank row between these two rows.
I have started with a loop, but somehow it does not work.
Sub AddRows ()
Dim Row As Long
For Row = 1 To 3800
If Cells(Row, 1).Value = Cells(Row + 1, 1) Then
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End If
Next Row
End Sub
View 9 Replies
View Related
Dec 14, 2009
I want to delete a row in excel based on a condition.
The condition is as follows:
I have few rows in the excel where the columns 7,12,13,23 are same and column 24 in one row has some number and in some other row the column 24 is blank with orange color filled(the colorindex for orange is 44).
In this case I want the row with orange color filled in column 24 to be deleted.
View 11 Replies
View Related
Jan 28, 2009
i looking for function, which will give me a results if its the person good , bad and other (Y). It will look based on column A, but if will be more equal names in this column, it looks in the column surname (B) and return value from column (Y) in this row. But it can be more equal column B.
Here is an example:
Results what i want are in Z1,Z2,Z3
X Y Z
1 sue doe good
2 joe bond very good
3 mark no bad
SOURCE table
A B C
1 john doe good
2 joe black bad
3 sue doe good
4 mark black not bad
5 joe bond very good
6 mark no bad
7 kat doe bad
View 4 Replies
View Related