Adding Lines And Conditional Formatting With Macros

Jul 4, 2008

I have only recently started playing around with macros, and am slowly getting into them. I do however still struggle a bit to ‘read’ them. Having played with formulas for years I can generally translate a string of formula text into English, like ‘if this cell value is greater than that cell value, then do this, if it is not then if it is equal to that cell value, do that, if not return 0’. Babbling like a child basically.

With visual basic I have managed to record some handy macros and then tweak them a little manually but I am still struggling to follow it going through it step by step reading it like a formula. So I hope you won’t mind me asking some very stupid questions. I mean well; I’m just a bit slow.

At present I am trying to do two different things on two different sheets, and I was wondering if perhaps one of you could nudge me in the right direction.

1:
I am trying to insert a blank row above every row that has a certain word in column B.

So basically ‘find value “Example” in column B, and when you find it, insert an entirely blank row directly above it’.

2:
Is a bit more challenging. I want to change the colour of a cell if the value in the cell corresponds with the value of another cell in the same column.

For example, I have a long list of surnames in column A. When I add ‘McNeil’ at the bottom, I would like to be able to run a macro that checks if the name McNeil appears anywhere else in column A, and if it does, that it changes the colour of the cell.

Preferably both of the cells that say McNeil, but one would do very nicely indeed.

If that is possible, I wonder if it is possible to do the same with the first name in column B, but only if there was a match for the surname in column A on the same row. So, if McNeil does not appear in column A, don’t bother, but if it does, does the corresponding first name appear in column B?

If both of that is possible, the next step would obviously be if McNeil appears in column A (say twice, once in A123 and once in A678), do cells B123 and B678 match as well?

View 14 Replies


ADVERTISEMENT

Inserting Space Between Lines In Conditional Formatting

Dec 5, 2013

I need to create a spreadsheet that has approximately 1000 rows with the same exact information in each of them prefilled (as I use the "drag-down" method). I use this chart throughout the year to enter various bits of data in each row. I also use conditional formatting in each row. The company I work for wants to have an empty space between each row.
"
You can create the blank rows separately and then interleave them with the existing rows by sorting. To start, insert a new column to the left of the existing column A. Enter 1 in cell A1 and highlight column A all the way to the last row that contains data. From the Edit menu select Fill | Series and click on OK. Column A should now contain numbers from 1 to the total number of rows. Press Ctrl-C to copy these cells to the clipboard, click in the cell just below the last of them, and press Ctrl-V to paste. Now highlight the entire data area, including the new rows with just a number in column A. Select Sort from the Data menu and choose the No header row option in the resulting dialog box. Under Sort by select Column A, under Then by select column B, and click on OK. Finally, delete column A. You now have a blank row after every one of the original 1,000-odd rows."

This works great for the data that I copied (with the drag down method) to all the rows. However, this method does not insert an empty line in between all the conditional formatting I have throughout the spreadsheet. This is my conditional formatting formula I have "manage rules" which is under "conditional formatting" =NOT(ISBLANK($A6)) (*please take note that this is selected for 1000 rows.) Maybe there is some kind of change in the formula that I need in order for the conditional formatting method to be copied onto every 2nd line of the 1000 rows".

View 10 Replies View Related

Colour Alternate Lines With Conditional Formatting

Jul 28, 2006

change the colours of alternate rows in order to make reading line by line easier. I know that I have used this before as a Conditional action ie:- if(mod...... etc

As always, the program I used it in has 'disappeared' so I can't check back with that.

View 5 Replies View Related

Conditional Formatting Verify That The Lines Of Data Being Pulled From My Application

Jun 9, 2009

I would like to use conditional formatting verify that the lines of data being pulled from my application into Excel, but totaled using "=sum" are equal to totals pulled directly from my application. I believe that I should be able to use conditional formatting but am not sure how to make the formula work correctly.

To illustrate my problem: I have cells A1 (a total of a range), A2 (also a total of a range) and A3 (total of data pulled directly into my Excel report). In cell A3 I would like to verify that lines A1 + A2 - A3 = 0. This I can do without any problem, but there is rounding involved. The total of the above formula should be between -1 and 1 and still show as correct. I want the number in A3 to show up in red/bold when incorrect.

View 6 Replies View Related

VBA Macros For Conditional Formatting And Column Hiding

Oct 11, 2013

I am totally new to Macros. I need a Macro which should format a column based on the value of another column.

Consider I have 10 rows. I have to format column D, based on the value of Column E. If the value of Column E is > 1000, then the background color of Column D should be changed as green. The most important requirement is Column E should be invisible, Changing the font color of Column E as White does not seem ok cuz when we select the sheet entirely using Ctrl+A, the white values are very much visible. Can this be achieved using a macro?

View 9 Replies View Related

Adding Cells Based On Conditional Formatting

Sep 17, 2009

I am using conditional formatting to make cell background's go red if the data satisfys some criteria

Now I want to add the values in those red cells, can anyone make a suggestion as to how I can do this.

View 6 Replies View Related

Conditional Formatting Stops Working After Adding Column

May 21, 2013

I have a conditional formula that highlights dates red when it meets a certain criteria. The file named MS Working, the conditional formatting formula (formula below) works as it should with no issues. The other file MS NOT Working, the conditional formatting formula (formula below) has stopped working as it should. What I did? I inserted a new column to the left. Where the MS Working file has only 1 column to the far left, the MS NOT Working file now has 2 columns to the far left.

It seems as if the formula adjusted itself when I inserted the new column; however, its not working.

MS Working
Conditional Formula: =AND(TODAY()>B3,NOT(ISODD(COLUMN())),B3<>"",OR(C3="",C3=0),B3<>0)

MS NOT Working
Conditional Formula: =AND(TODAY()>C3,NOT(ISODD(COLUMN())),C3<>"",OR(D3="",D3=0),C3<>0)

View 3 Replies View Related

Conditional Formatting: Reference Changes Adding/Deleting Rows/Columns Or Cells

Sep 26, 2006

I'm using Conditional Formatting for an entire column to check the value of each cell and compare it to the value of a cell in the same row but a different column. (Cell Value equals =$D2) It works great until I insert or delete a cell in the formatted column. The reference does not change as one would expect. I've played around with formulae such as =$D2<>$P2 but the reference only changes for the P2, not the D2. I've also tried using =CELL("contents", ADDRESS(Row(),4)) but this causes excel to complain.

View 3 Replies View Related

Excel 2007 :: Conditional Formatting And Adding Text To Cell Based On Multiple Cells

May 31, 2013

I'm using Excel 2007. I would prefer to stay away from the scripting side of the house if possible. This is basically a 3 day forcast weather chart. The top is the actual weather data, the bottom portion is a color coded reflection of how the weather affects various things.

This product is created in excel, but will be embedded into a powerpoint. It will be updated daily. Here is what I would like. I want the color chart at the bottom to update automatically based on the data I enter above. I have a grasp that I can update the color through conditional formatting, although im not exactly sure what that will look like with all of those cells.

I also figured out that I can insert the letters in those lower cells with something similar to " =IF(C6>90, "T", "") " which would put in a 'T' for Temperature when the temperature got above a certain degree.

I run into a problem when I have multiple factors affecting a single cell. For instance on the example in day 2 of my image. Personnel are affected by Temperate AND UV Index. How would I set up that cell to pull that information from both of those cells and display it accordingly? I would prefer the letters to stay separated by the comma, but I could live without that. The default cell color will be green, with the potential to be yellow or red. I left a few examples of possible situations on day 2 and 3.

View 3 Replies View Related

Coloring Lines In Posted Macros

Jan 26, 2009

In posting macros I would like clor some lines of the macro. I tried writing the macro in microsoft Word and colored the lines and copying to the board, but the corlor does not come up.

View 9 Replies View Related

Adding New Lines To Current Code?

Dec 1, 2011

Code:
Sub Final()
Dim NameCell As Range
For Each NameCell In Sheets("! Names").Range("B1", Sheets("! Names").Cells(Rows.Count, "B").End(xlUp))

[Code]....

I want to pull data from ! Names. This code already Renames a new sheet from the ! Names sheet and also puts there name in cell C2 and phone number into cell C3 of the created sheet. I want to put more data from the ! Names sheet. How would i go about adjusting current code to do that?

View 4 Replies View Related

Adding Title Lines Within A Macro

Jul 20, 2007

i am completely new to writing macros. have recorded a macro but have just found out the each of the new sheets that the macro creates needs a line at the top of the sheet with a title in it

View 2 Replies View Related

Adding Grid Lines And Line Numbers In The Report?

Mar 4, 2014

See the code below. It works fine but in the report that gets printed off, it doesn't display grid lines and line numbers .

[Code] .........

View 3 Replies View Related

Adding Reference Lines To Chart With Primary And Secondary Axis

Jan 10, 2014

I have a chart with sales data on one axis and inventory on a secondary axis. I have the average of each columns of data and want to add a reference line to each axis with it's average. I have added the averages to my data set, but it only adds the reference line to my primary axis. I actually began by manually inserting two lines to the chart (which seems asinine). They actually didn't print because they weren't actually on the chart, but rather just on the spreadsheet behind.

View 5 Replies View Related

Select Series (lines) In Line Graph By Adding Userform With Checkboxes On A Chart

Apr 15, 2014

I want to add a user-form on a chart, which will have check-boxes that will allow me to select series(lines) that I want see and compare in a chart. Currently my line chart has 24 series (Lines) which makes the chart very difficult to view and looks very busy. How do I add list of check-boxes that will allow me to select one or multiple lines that I want to see at a time?

View 2 Replies View Related

Conditional Drop-Down For Multiple Lines

Jul 29, 2014

I have a list of car-dealers and licence plate numbers. f.e. data in tab 1 Supplier-Cars.jpg

In another tab (let's call this tab 2) I have to make drop-down lists, depending on the value in this drop-down the cell next to it must give the list of cars from this supplier. f.e. if I select in the first line Supplier 1, I get a drop-down list where I can select Car 1 if I select in the second line Supplier 4, I get a drop-down list where I can select Car 4, 6 or 7 etc. Because of the number of suppliers, I can not work with predefined lists where I put all the suppliers one next to the other...

have a drop-down in each line to go look for the cars depending on the supplier I selected ?

View 2 Replies View Related

Adding Multiple Macros To Combobox?

Mar 25, 2012

I'm having difficulty assigning multiple macros to an active x combo box. I want a different macro to run every time the user selects a different location from the combo box. I can assign one macro to the button no problem, but don't know how to incorporate more. The two separate macros I want to run are:

Sub Atlanta()
'
' Atlanta Macro

[Code]....

View 1 Replies View Related

Analysis Of Adding Extra Row To A Model With Lot Of Macros

Apr 27, 2014

I have recently started working on a model built by some one else and I need to add a extra row to model. The Model has lot of macros on every page. So i need to know how adding an extra row is going to affect the macros.

I understand the main problem would be that the references in the macro wont get updated which might lead the macro to malfunction.

Whats the best way to analyze which macros are getting effected.

View 1 Replies View Related

Conditional Formatting - Two Different Fields Affect One Cells Formatting For Date?

Sep 16, 2013

A little background on what i am doing. I have a spreadsheet that tracks when i have blown the dust out of our computers. I have set up conditional formatting so that the text turns red after 300 days and the cell turns yellow after 600 days. However, some computers are in high dust environments. I would like the spreadsheet to tell me to blow the dust out of these sooner. see the attached sheet.

dust 1.xlsx

View 2 Replies View Related

Assign 2 Macros To 1 Button (or Adding VBA Code To The Existing Macro)

Dec 23, 2009

I'm verrry new to editing VBA code and I've been trying to figure out how to send a column of data ("Min Data" AB3:AB21 from "Sheet1") to a worksheet ("F4" - Min) and sending another column of data ("Max Data" AC3:AC21 from "Sheet1") to a different worksheet ("F4" - Max) by using only the one button ("Record Data" from "Sheet1"

I've been trying to figure out ways to edit the VBA in "Module 1" to make this work

Can anyone help me out here? If what i'm asking for isn't clear enough, just let me know and i'll try to explain in more detail.

View 6 Replies View Related

Adding Worksheet Protection But Allowing Form Controls - Macros

Jun 5, 2014

I have a worksheet with lots of things going on... the end user needs access to the Name field, DOB field, all the scroll and form control option buttons in the 9-question sheet, and the macro-enabled reset button at the bottom. Formulas are sprinkled throughout the worksheet, in columns T through AC... option button links go to AA and AB.

I would like to protect the entire sheet so none of the fields, except where indicated above, could be selected or edited... but when I protect the sheet, I get errors when trying to use you form controls, and the formulas do not respond. And finally, when protected, I get a debug error on the reset macro.

View 2 Replies View Related

Conditional Formatting Based On Another Cell Conditional Format

Mar 20, 2013

Is it possible to change the format of cell AI3 based on the format of cell C3 and D3? I have C3 and D3 set to turn red based on what is in cell C2 and D2. I would like the following done:

If AI3=C3 & C3 is red, format AI3 blue
If AI3=D3 & D3 is red, format AI3 blue
Otherwise, leave AI3 unformatted.

Possible???

View 3 Replies View Related

DDE Macros And Data Formatting

Mar 26, 2008

I'm working with a data logging system to collect data on a circuit. The logging software allows you to export the data collected to Excel in real time using DDE, and having talked to the logger company I managed to obtain a macro to get the data into excel (I'll put it at the end of the post). This works fine, and I can now press a button and Excel updates itself with the new data every second. What I want to do is quite complicated and I have no idea where to start:

1. The data obtained via the macro only displays in static cells, that is when the new data comes in it overwrites the old one. I want Excel to take a copy of each new bit of data as it comes in, and copy and paste it into a column on the same sheet so that it can be stored. I then want it to move down a row and take the next reading and so on, so that each time a new reading comes in, Excel takes the value and puts it in the next row down in a set column

2. Having a time elapsed measure would also be very useful, so that it records the time after starting the other macro in a column next to the ones collecting the data as described in 1. In this case, each new row would be 1 second further on. The actual time is not massively important, just the 'relative' time since the data collection started.

3. Once the data is copied into the columns to be stored (1.) I then want to calculate two sets of moving averages and place those in columns next to the data. My current plan is one average of 30 samples and another of 5.

4. Once I have the moving averages I can then get Excel to plot some graphs to show the progression of the two values
5. Since my project is revolving around detecting a short circuit in a coil of wire, it is looking for drops in resistance. I want Excel to be able to monitor the two calculated moving averages and if the difference between them exceeds a set threshold for more than 5 samples then some alarm is triggered (for now just a cell changing colour to red or a pop-up box or something).

View 12 Replies View Related

Superscript Formatting In Macros

Jul 25, 2006

I have a cell (A1) that, depending on a choice made elsewhere in the workbook, will return A2, A3, A4, or A5, which are all formatted differently with superscripts. How do I get that formatting to copy over to A1 without having to manually copy and paste format from the appropriate cell? I have to do this for a range of cells (A1:A15) instead of simply one.

View 4 Replies View Related

More Conditional Row Copying Using Macros

Jun 13, 2006

You assisted me in writing a macro to move rows from one worksheet to another based on column criteria. I need a slight improvement to the code, ie it should only delete the rows after moving them if the rows are those that matched the criteria and not those that simply had blank cells for criteria after the rows moved are deleted.

Private Sub CommandButton1_Click()
Dim c As Range
Dim count As Integer
count = 0
If MsgBox("Are you sure you want to move rows to the archive ?", vbOKCancel, _
"Archive") = vbCancel Then Exit Sub
On Error Goto catcher
For Each c In Range("J1:J" & [sheet1].[a65536].End(xlUp).Row)
If c = "yes" Or c = "good" Then
count = count + 1......................

View 2 Replies View Related

IF Statement Using Formatting Criteria (NOT Conditional Formatting)

May 5, 2009

Is there "code" for different formatting in a spreadsheet so you can use an IF statement to do something like:

if(A1=blue background,"Yes","No")

or

if(A1=red text,"Yes","No")

etc.?? But replace "blue background" and "red text" with some sort of number code? I want to compile a list of the items that are formatted with certain background colors and/or text colors and then organize only those items into a chart.

View 5 Replies View Related

VBA To Convert Conditional Formatting To Fixed Formatting?

Jul 5, 2013

Any VBA that I can put into a macro that will convert conditional formatting into fixed formatting..? So when the cell contents/formulas are deleted the formatting remains. Assume that the range I want to convert is A1:D200...

View 9 Replies View Related

Adding Multiple Lines When "IF" Is True

Aug 25, 2008

Sometimes one employee may appear under more than one group (bartender, barback, waitstaff, etc.). I need to insert a formula that will check the other groups to see if this employee worked any hours in another group that week (I would assume a VLOOKUP would work), and then distribute the overtime hours accordingly.

If you view the attached worksheet, you can see I've entered a name and some hours. The formulas in cells M2 and N2 are my attempt to fix this problem. Anyway, the way the overtime hours are distributed is based on the group they worked under after they reached 40 hours. So looking at the example on the worksheet, Bob should have all of his overtime (13 hours) appear under O/T in row 2 because the 9 hours he worked on the waitstaff was before he was "officially" earning the overtime.

So I am needing the formula to check all of the groups other than it's own for a duplicate, add the total hours, and distribute the overtime accordingly.

View 14 Replies View Related

Entering, Formatting & Manipulating Data Using Macros

Apr 11, 2008

I would like to give credit and thanks to StephenR for producing the current Macros in use on this spreadsheet.

This was to sort out Raw Data that I get from a database, and with lots of help sort it and format so for a history of this you can look there.

Now I need to enter in some formulas, data from another spreadsheet and cell formatting…

Unsure if all this is possible but am hoping some of it is…

First Thing
The column Run Time has the data in them already this is the time in minutes am looking for a way to put a formula in, that will make them into hours so the formula will read like this “=180/60” this will give the number 3 as the whole number.

Second Thing
Using the whole number that the formula made in the Run Time column, am looking to fill cells with colour, too see what I mean here its best to take a look at my mock up spreadsheet.

Third Thing
Two rows below all the data that gets sorted out I would like to put in two totals, one for Run Time and another for Available Hrs “=SUM (Range)”

Forth Thing
I have data in another spreadsheet that is the Resrce Name, and Available hrs am looking to take that data from this spreadsheet that will be closed opened if needed, this data will assign workers to Work Centres.
I would like this to be a separate macro to run though all the sheets if possible.

View 14 Replies View Related

Looping & Conditional Format: Finds A "J" It Will Apply Conditional Formatting To A Row Of 4 Cells Directly Adjacent?

Feb 9, 2009

I need to run a loop through a column of values (attachment col B) and when it finds a "J" it will apply conditional formatting to a row of 4 cells directly adjacent. The attachment is a theoretical before & after.

View 2 Replies View Related







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