Is it possible to use the same macro when ranges have been changed? Attached is a sheet that I update frequently (rows will change day to day, not columns) and the goal is to have a dynamic macro that sums the rows highlighted in yellow and red. Is this possible?,
Sub appointment_nieuw() With CreateObject("Outlook.Application").CreateItem(1) .Subject = Range("C3") .Start = DateValue(Range("A3")) + TimeValue(Range("B3")) .Duration = 0 .Location = Range("D3") Dim cell As Range For Each cell In Range("F2:H2") .body = .body & Space(2) & cell Next .Save End With End Sub
I have this macro that works great, but every time I have a different appointment. I have to go into VB editor and change the ranges for the subject, datevalue, timevalue, location and body.
Can I get a text box (or something better) to pop up and I enter the ranges for the 5 in it and have it change in the macro?
1. An amount of money is invested on the first day of any given month of the year;
2. This investment earns interest (calculated at a nominal , not effective, rate) which is credited each month in arrears;
3. Once the interest is credited, it is withdrawn and the effective original investment amount is carried forward to earn interest again (which is yet again withdrawn) until the investment matures in, say, 24 months, when the capital is paid out;
4. On each withdrawal, a certain portion is (with this specific investment, in case you wondered!) susceptible to certain Taxes, which I want to calculate for each Tax year (or portion thereof)
In South Africa, the standard Income Tax year runs from 1 March through 28(9) February of the next year.
I am trying to figure out a formula that will calculate the Taxable Portion of the withdrawal for each Tax year (actually, it may even be done for each month and simply totalled in February for the previous Tax year / portion thereof) until the investment matures.
If an investment is made on 1 June, I need to sum the payments from 06 to end 02 (Tax year1), then sum the totals for months 03 to 02 of the next Tax year and then sum the totals for months 03 to 05 (i.e. 31/05 - ending the 24 month investment period) for the third Tax year.
What can I do do allow for this ever changing differing in the inception month of an investment?
I've attached a s/ sheet where I've used all sorts of statements to mark the inception month (year1) as "Mark1", month 2 as "Mark2", month 3 as "Mark3" and the last month as "Mark4", I've used "running months" (1-24 in the example above) etc, but cannot figure out how to use any function I know to help!
I m trying to get around here within the company I work for.
I'm interested to know how to set a specific range value e.g. "5 to 10" once a value is between those 2 numbers, and then if the value in the next row below is 34.12 it will be "30 to 35".
Here's an example code I constructed, but the darn thing just keeps on running
I have a workbook with several sheets and named ranges like ES_Date, ES_Range, ES_Volume or MC_Date, MC_Range, MC_Volume. The 1st two letters are the name of the sheet where the named ranges are located (one is dates, another volume, etc.).
What I'm trying to do is calculate averages, extract maximum and minimum values from the the named ranges using a start and end date that are entered in cells "H6" and "I6". The formula I am using right now is:
I have a database in excel with a lot of tables in which lets a uses a combo box so the user select can view just one table.
I want to be able to create a macro so when a button is pressed, it copies the data into a new workbook and creates a chart so they can do whatever they want without disrupting anything in the original workbook.
I have been able to find code that will export the data and create a chart (see below) but the problem is the range changes from table to table so I need to find a way of changing how the chart picks up the data range.
Sub Chart_New_Book()
Sheets("Temp").Select Cells.Select Selection.Copy Workbooks.Add ActiveSheet.Paste Range("A1").Select Charts.Add ActiveChart.ChartType = xlColumnClustered ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range("A1:C10") ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1" End Sub
So at the moment when charting ony cells A1:C10 will be plotted no matter what the size of the table is and making the target range bigger only sees the blank cells being plotted.
This is the link to the thread where ByTheCringe2 showed me the power of SUMPRODUCT and sorted my problem out. I don't think you'll need it, but I'd rather reference it before Roy reprimands me! lol
I am building on the same topic, though.
Hi All!
I have an investment where the monthly interest is added back to the capital. The next month earns interest on the higher figure and this higher interest is again added onto the capital and the story starts all over at the next month. OK, that's easy to do (Again, I think!).
All works fine UNTIL the end of the Tax year is reached and Tax on the interest earned is payable from the investment as the capital carried forward is reduced by the Tax payable. In the attached file I show how I calculate the interest earned for each following Tax year (which always ends at month 2) using SUMPRODUCT. Sumproduct is used because I never know whether the initial investment is made in month 5, 11, or any other month and by using certain controls (thanks ByTheCringe2!) I can simply total the interest earned in each tax year - the months between month 3 (start) and 2 (end).
On a seperate sheet I calculate the Income Tax payable as follows:
Firstly, I calculate the standard Tax payable on the investor's income from other sources. I then add the taxable portion of the interest to the standard income from other sources and calculate the tax payable on that combined figure. I then deduct the two figures from each other and get the increase in Tax payable because of the interest earned.
This "increase in Tax payable"-figure is then returned to the spreadsheet on which the interest is added onto the capital. See Sheet2! cells O9:O15. The Tax payable for each Tax year is placed next to taxable values I calculate using SUMPRODUCT (again!) in column N9:N15.
VLOOKUP is then used to transfer this Tax payable figure into the calculations (Column K9:K68) as and when required (only when tax is payable) - and should be deducted from the value in (Same row) Column H and that answer should be transferred to next row Column E (Balance at beginning of month) -
BUT it causes CIRCULAR REFERENCE faults and I am absolutely frustrated at not being able to figure out how to sort it out!
Sheet2, Column E9:E69 (See Sheet2!E19 for Comment explanation) in the attached workbook.
what needs to be changed on this code to only apply once for the row and not over and over again.
Dim Cell As Range If Application.Intersect(Target, Range("ActivityRange")) Is Nothing Then Exit Sub Application.EnableEvents = False For Each Cell In Range("ActivityRange") If Len(Cell.Value) > 0 Then Cell.Value = Cell.Value & Chr(10) Next Cell Application.EnableEvents = True
I have two reference points "start_calc and end_calc" and I'm trying to figure out what the coding is in the a macro to sum everything between these two ranges.
In case that's not clear, say reference point #1 is A1 and reference point #2 is A26. in A27 I want to the Sum of A1 to A26. But the next time the macro runs the data points migh be A1 to A27 and so on.
This is why I'm usind start_calc and end_calc references rather than specific cells.
What my code needs to do: It needs to verify data in column rows say for this example columns A to C and infinite rows. It needs to verify the data in this order A1, B1, C1, A2, B2, C3 etc. (One of the part I have problems to do) It also needs to add to a row/cell "1" when certain conditions. (In the same line as the last checked data in the column "D" say for exemple last data that was checked is "A3" well the 1 must be written in "D3". The conditions are simple the first Data the macro encounters must be higher than 0.25 and all following data must be higher than 6, whenever the next data is lower than 6 or empty add 1 to the corresponding D row and restart at the 0.25 cell "checking".
I'm using a macro to drag down a formula across a worksheet then again further down the worksheet which is working ok but I know there has to be a better way of doing it. At the moment every time I add a new column I have to edit the macro over and over and its getting out of hand. I know there must be a way of rewriting the macro into a loop but my skills are obviously still new.
Here's the macro:
[Code] ......
This continues over to column AO so far then I drop down a few rows and do it again:
[Code] .....
I think I need to set variables that set the row and column each time. maybe a "drag formula one column at a time from row x to row y until column header is empty then move to the new row and repeat"?
I have a code that clears the content of a cell if the value of that cell exceeds two.
Code: Option Explicit Private Sub Worksheet_Change(ByVal Target As Range) If Cells(1, 1).Value > 2 Then Cells(1, 1).ClearContents End Sub
My problem is the value of this cell comes from a function and changes every second automatically (linked to a data feed). So I'm not changing it manually, therefore my code is not working unless I touch it. I just wanted to ask if I can add a code onto this which checks the values and runs the ClearContents macro if there is any change.. I've got a few sheets like this so I need this to run in the background..
I want a vba macro which performs some thing like this. I think probably this can be done by using InStr function, the macro attached here just find the exact same value and shows the result but i want similar values,
I have a sheet containing employee data - 13,000 rows - one for each employee.
Column A contains their store number (there are about 1300 stores in total) and column H contains their name.
Is it possible to create a macro that, for each change in store number, will create a named range for the employees' names in that store automatically?
I have a table sorted on column A. I need a macro to go row by row on that list and stop when the NAME (column A) is changed, in this example 3 first rows "aa". then I need to define the range of these 3 rows (A2:D4) in the table and make some subroutine. After finishing with this range I need the macro to continue and find the next rows with the same name, define the Range and go to the subroutine (in my example A5:D5)
The next range will be A6:D7 and so on until last range A27:D27. How can it be done?
I tried some CASE, FOR NEXT, DO UNTIL loops to do this but get stuck.
DATA *ABCD1NAMEDATEALERTTEST 2aa10HB3aa20INR4aa41WBC5ww50ELE6zz30DIG7zz61HYD8dd21CRE9dd41PLT10dd60HB11dd71INR1 2rr10WBC13tt20ELE14tt41DIG15yy40HYD16uu51CRE17ii20PLT18ii31HB19ii51INR20ii70WBC21ii80 ELE22oo20DIG23ll11HYD24ll20CRE25ll30PLT26mm21HB27nn30INR
i have a workbook with about 32 sheets (number of days in the month, plus index page). each sheet has info on mutliple shows, i was wondering if there was a macro that i could use to go to Sheet 2 (first day of the month) selecet B10:B200 and name it date1, move to the next sheet name it date2, and so forth, through the end of the book.. then go back to sheet 2 select the next 4 columns rows 10 through 200 (in this case, C10:F200), name it Show1Date1 move to the next sheet and name the rance Show1Date2, then go back to sheet 2 and do it again ie G10:J200 named Show2Date1, next sheet is Show2Date2.... and so forth until we hit the end of the workbook at Show30Date(either 28, 30 or 31 obviously)....
I cannot seem to get the worksheet function sum to work with varables in this module. It is placing zeros where the summed data should be. The variable are showing proper start and end ranges for summation....
Is there any way to create a Macro that is any cell in column D has the word Shop it would change the adjacent word in column E from Roof Time to Shop Time?
I have a workbook that has a saved range. I created it with the Name Manager. See below:
[Code]....
When it looks like that the VBA works great and creates my pivots. But after I run my first macro to mess format my source data the range ends up looking like below:
Is there a way to change the value of cell A1, for example, from one value to another, hit the enter key, and activate a macro this way.
A couple of qualifications: - the value in cell A1 will never be the same (that is it could be -23.43 or .12) - I can not simply tie the macro to the "enter" key as there will be numerous cells (A1, B3, C90 and so on) in the same sheet that I will need to do this with, each tied to a different macro.
I have a calendar I have developed that highlights the current date and opens by default to the current month. Each worksheet is a seperate month. The current date highlighting is written with a public macro and the opening to current month is a private macro. The problem comes when this workbook is shared and the other users have to agree to accept my macro because of security. I would like to bypass that requirement and just have the workbook stand alone without the permission.
Is it possible for excel to monitor Row J for a letter "Y". If a "Y" is put into a cell in row J a macro runs. If the "Y" was in column 6 I need the macro to copy A6 B6 C6 D6 E6 F6 etc to other cells on a different worksheet.If "Y" was in column 7 it will copy A7 B7 C7 etc to the same other cells on a different worksheet.
I have a template work book that has several worksheets with numerous formulas thorughout.
For example; =SUMPRODUCT(--ISNUMBER(SEARCH("MCSH",P9:P218)),--ISNUMBER(SEARCH("HWD",G9:G218))).
When I set up another template for a different crew I manually have to go through the entire work book and change the crew identifier (MCSH) in every formula.
I have a worksheet where I want the to change the collor of a range of cells in accordance to the value in another range of cells.
So if the value is "Gron" in cells C4:C27 then I want cells J4:J27 to return the color green. If, however, the value is "Rod" in cells C4:C27 then I want cells J4:J27 to return the color red.