Function SumIfPurple(inputRange As Range, _
answerRange1 As Range, _
answerRange2 As Range) As Variant
Dim SumAnswer As Variant
'If inputRange is turned purple then it is equal to anserRange1, if it is left with no fill it is equal to answerrange2.
If inputRange.Interior.ColorIndex = 39 Then
SumAnswer = answerRange1.Value
Else
SumAnswer = answerRange2.Value
End If
SumIfPurple = SumAnswer
End Function
I would like to have a sub that will have the formula automatically calculate when the inputRange's color is changed.
how to alter this Private Sub for my code to execute automatically once all 3 cells have changed. At the moment it executes as soon as any of the 3 cells change.
There is a column in my spreadsheet which needs to reflect a " percent done". I used to enter just a numerical value in (eg. 20) to reflect 20% done. My boss wanted it to show as an actual percentage (eg. 20%). I changed the format to Percent, Zero decimal places. Then you had to enter .20 to get the 20% to show. Now my boss doesn't like that - and wants to be able to enter "20" to get the 20% to show. I put the following code in my SelectionChange event...
Private Sub Worksheet_SelectionChange(ByVal Target As Range) 'other logic If Target.Column = Asc(PercentDoneColumn) - 64 Then If Target.Value <> "" Then Target.Value = Target.Value / 100 End If End If 'end other logic End Sub
My problem is that this works well when putting a new percentage in, but not for when you click on a cell that already has a percentage in it. For example, if you have .2 (displaying "20%" in the cell), and click on that cell, it divides that number by 100, and gives you 0.2%, displaying as "0%". I want to enter a number between 0 and 100, have it displayed and stored as a percent. At this point, I'd settle for the displayed, but would prefer to have it stored as a percent, too. I also want it to not reset my value unless I'm putting a new value in!
I'm trying to code so that any changes made to Excel document will automatically change in PowerPoint. I have Copied and Pasted Special link so that its connected but when ever a change is made in Excel in powerpoint I get a pop up box saying I need to press update. But I want to bypass the pop up update box and have it so that powerpoint automatically updates when I change something in Excel.
This is the code I have so far. I don't know if it's right or if I am on the right track as I get a compile error saying I need a End with.
I have some rather complex formulas that when a value is placed in one of any three cells it solves for the other two, taking values from other places on a worksheet (including the cell itself).
Scenario: Cell F10, G10, and H10 all have formulas in them. If a value is placed in F10 it solves for G10 and H10. If a value is place in G10 it solves for F10 and H10. If a value is placed in H10, it solves for F10 and G10.
I really do not think the actual formulas matters at this time...
Has anyone done this before, using VBA code to place the formulas in cells F10 G10 and H10? Look for a working example of this if possible.
We have 3 PCs, all running MS Office 2013. On 1 of these machines, it is doing strange things with formatting. If you open a document or try to paste anything into certain documents, it decides everything is currency format and assigns all sorts of wrong formatting to the entire sheet, or the entire document. There may be some cells in the doc that are indeed currency, but only a small proprtion. If I open a new, fresh document and paste into that document, it does not do this, it seems to work normally, only applying currency formatting where it might be applicable. On some larger docs that have this issue, no matter what I do, it just continues to apply these strange settings.
I am very new to vba and trying to figure out an auto save macro that will automatically save my workbook when a certian cell range is changed. Right now I have a macro set that automactially record the time and date of when a change is made to the name cell, I want to set up a macro that will automatically save the file when the time is updated.
This program is used by several users and they have a tendnecy to forget to save the program so that when other people want to check the updated data nothing has changed because the changes have not been saved. I have attached the file that I am working on. When a change is made in column F then Column G automatically updates, now I want column G to trigger autosave. I would also like a msgbox to appear to tell user that file has been saved.
In my Excel 2003 worksheet, I need the row color to automatically change to blue (color 5) (bgcolor = #0000FF) - when the user changes the text from VALID to INVALID in the range: B3:B65000.
For example:
Cell B5 contains the text: VALID
When the user changes the text in the field to read: INVALID - then I need the row range: A5:W5 to change to the color blue.
I am looking to have a macro which will automatically add the username and date to a cell, when the cell above changes (or in this case =x). I have a bit of code from a previous project, but I have changed Target.Row to Target.Column and it is not behaving as I require:
Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Range("B2:BZ2"), Target) Is Nothing Then Range("C" & Target.Column).Value = Format(Date, "dd-mmm") & " " & Format(Time, "hh:mm") & " by " & (Application.UserName) End If End Sub
See the attachment for the example. What I need is whenever row 3 ="x" I need the corresponding cell in row "d" to update with the latest date, time and username. Please not the macro is currently not active on the sheet as i've added the ' character.
I have the following code pasted into the worksheet module which used to work fine but no longer does. I didn't touch the code, it just stopped working.
Private Sub WorkSheet_Change(ByVal Target As Range) Select Case Target.Address Case "$A$16" Select Case Target Case "Custom Color 1": Call CustomColorInput1 Case "Custom Color 2": Call CustomColorInput1 Case "Custom Color 3": Call CustomColorInput1 Case "Custom Color 4": Call CustomColorInput1 Case Else: End Select Case "$A$17" Select Case Target Case "Custom Color 1": Call CustomColorInput2 Case "Custom Color 2": Call CustomColorInput2 Case "Custom Color 3": Call CustomColorInput2 Case "Custom Color 4": Call CustomColorInput2 Case Else: End Select Case "$A$18"
CustomColorInput 1-6 are the same except they input data into different cells F16-F21.
When I attach any of the CustomColorInput macros to a button it works fine. When I try to call it from the worksheet module, the data input box pops up but the data doesn't get entered into the cell. When I try to step through the CustomColorInput macros using F8, the input box pops up, I enter data and press ok. Then I continue with F8 and the debugger jumps to a custom function that I entered (below), which is not called for and is in no way related to the code.
Function PullAfterLast(rCell As Range, strLast As String) PullAfterLast = Mid(rCell, InStrRev(rCell, strLast) + 1, 256) End Function
When I close VBA, the data that I typed into the data input box is in the correct cell.
So basically, I'm getting three different responses from the offending code depending on how I call it up. Can anyone tell me what's going on?
More generally, in this and previous occasions, I've had problems with macros that cease to work for no reason that is apparent to me. What are some things that would cause a macro to stop working, without actually changing the code (other than the obvious, like referring to names or worksheets etc. that don't exist anymore)?
I have a workbook that has two worksheets. One worksheet is an input worksheet. A user will select a date from a drop-down list and type in the events that occurred on that date in 8 adjacent cells. The user selects a button that advances date and clears form. On sheet 2, whatever was typed into sheet one is saved via VLOOKUP formula. However, if I try to change something retroactively and select a previous date from the drop-down list, it clears everything in sheet 2 that was typed for any selected day.
I have created a pivot table that is connected to an input sheet with data. The input sheet retrieves data automatically from a external source through an add-in to Excel. When updating data the fields expands, but only for the items which have been changed. I want the table to be updated automatically, but not the fields expand automatically. Is there any pivot options to prevent this problem?
It should be mentioned that the pivot table is not directly connected to the input sheet (which is updated from the external source), but from a "help-sheet" reflecting the input sheet with some additional columns. I use conditional formatting and name range in the pivot.
I am trying to have some automation to my WS and what I want to do, is if a certain column (column 104) is changed, it will fill out that column with the data entered as long as the account is the same (column 5). Here is the code I tried, but realized very quickly, it puts me into a loop. This is being called by a change worksheet fuction
If Target.Column = 104 Then If IsEmpty(Target) Then Else testacct = Cells(Target.Row, 5) temptest = testacct s_TempSwitch = Target.Value Testoffset = 0 Do While temptest = testacct temptest = Cells(Target.Row + Testoffset, 5) Cells(Target.Row + Testoffset, 104).Value = s_TempSwitch Testoffset = Testoffset + 1 Loop End If End If
I have this scenario which i need to automate it. I have 5 colums P1,P2,P3,P4,P5. It contains W or L combinations.
In my Column F i Concatenate(A2,B2,C2,D2) together and it follows on for the rest.
Now i have some criteria which i am going to search in my Column G. In Cell I1 i will list my combination to search. It can be as follows :
WWWW LLLL WWW LLL
So what i need to do is search my F column for this possible match. If it is a match I need to color the my Player 1 to Player 5 for that match. I have shown in my example inside the excel. I know the formula for how to find for matches using my combination. But i got no idea on how i can color it with the respective colors automatically.
Yellow = all four W Red= all four L Green= will have 3 W and one L Blue = have three L and one W
I have 2 sheets, A & B. When I type something into sheet A, it goes to Sheet B, but if I change the cell color on Sheet A, I would like that to automatically color the same thing in Sheet B. How can I do this?
I have been given a spreadsheet that turns whole rows different colours when certain data is entered into a cell. I want to locate the code and use it elsewhere, but cant find it?
I have looked at all of the change related procedures in the drop downs, for the Workbook e.g.
Workbook_SheetChange
but no matter where I cant seem to find any code at all.
Is there a way of exporting every line of code and then open this file in notepad to skim through it?
how I might find the code that is making the rows turn different colours?
I am writing a program in excel spreadsheet and I was wondering how to fill an input cell with color automatically in excel 2007.
I mean that, say I am writing an addition program, I am giving an input numbers in B1 and B2 and i am writing formula in B3 (=B1+B2). I want excel to fill B1 and B2 with yellow/any color automatlically. Only the cells with number input should be highlighted.
I currently use spreadsheets to report on backup processes.
I am trying to speed up this process and one thing that woudl help me is a function that will automatically fill the row with a colour depending on the choice in the dropdown box, so if you choose 'successful' from the dropdown list the row colour would fill to green and if you select 'failed', the row would change to red and a choice of 'completed/errors' would result in orange.
This process is currently done manually and often results in errors like a succesful result with a red filling.
Is there anyway to automate this process? i was trying to whip up a macro, but have been unsuccessful so far.
I would like to automatically color the fill of a cell based on the cell contents.
For example, if the cell content is "1" I would like the color of the cell to be cyan and if the cell content is "2" I would like the color the cell to be red.
I've tinkered with several different formulas but I just can't get anything to work.'
how to do basic formulas in Excel but I are hoping that there is a macro or a VBA or something that can be made which might work for what i need.
I have decided to start a small tour shop (I make the reservations for guests with a hotel in the area and take them on tours of our region) and are looking to make a booking sheet for each month. Nothing complicated just simple. see the attached .xlsx file.
I was wondering if there is a way that when the fields in column A & B are filled in if it could automatically color the corresponding dates in for the same row in the calendar area? like I have manually done on sheet "October 2013"
I occasionally give presentations with Excel and would like to make it easier for the audience to see a particular cell when I move to it. The cursor can be tiny, and some people have a hard time seeing the cursor, so I use the keyboard to navigate to the cells I talk about. Yet, the cell, which then has a border around it, still can be hard to see.
Is there a way in Excel to have a cell that is highlighted, that is I move to a cell with the keyboard, so that it pops out in a different font color or background or format, when I move to it, and it automatically reverts to its usual format and color when I move away from it?
I am trying to simplify a spreadsheet. I have a column with dates from last year and I was wondering if there is a formula that would automatically change the color of the cell once the date is over one year to the day to show that the date in the cell has expired?
I'm looking for a way to make a cell copy the fill color from an adjacent cell.
in my case, cell A1 is a dropdown menu cell, where each option has a different fill color (through conditional formatting). what i want is to make cell B1 copy the fill color from cell A1 automatically. it may be important the both cells have dropdown menus.
Is there a way for me to enter numbers in my cells and have them a specific color? I want all my odd numbers to be bold red with a yellow highlighted cell, my even Numbers to be green with a gray color cell.
I want it to look like this 7 and 8. I can not seem to find anything to show the high light but basically the red 7 will be in a yellow box and the green in a light gray. I will be entering rows and rows of anywhere from 4 to 8 digits
I have this spreadsheet with tons of vba coding. The intent of the spreadsheet is to track invoices as it goes through the approval process. The part that is giving me issues is the first and seventh column. The seventh column is actually a formula that returns how many days between the invoice due date and today’s date. The coding works fine, with one small glitch. Once the dates have been entered, the first column (which contains the color-coding) stops changing colors. What it should do is anything with 0 or less days remaining should show red, between 1 to 10 days, show yellow and anything above 10 days, show green.
So if I enter an invoice with 11 days remaining to pay, it will show green in the first column, but when I open the spreadsheet tomorrow, it remains green, even though it should show yellow. What I want it to do is refresh every time it is opened, or every day, which ever is easier. There are reasons that we cannot use conditional formatting, one of them being that we want to expand the color coding system to more than 3 colors soon, but I want to get this working correctly first.
This is what I have. I cannot attach the spreadsheet because it contains confidential information.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim h As Integer Dim i As Integer Dim j As Integer Dim lastRow As String Dim fRowValue As String Dim gRowValue As String Dim mRowValue As String Dim rRowValue As String Dim uRowValue As String Dim paidCheck As String Dim stringAnswer As String Dim testAnswer As String Dim testDate As String