Macro To Convert Date Range To Line Items
Dec 14, 2013
I do not have any VBA knowledge. However, teach/show me how to write a macro to convert each new record (with a date range) into individual records for each day in that date range. It might take me a long time to learn from you but I really don't mind trying and putting in the effort. My description of the idea is shown below.
The intention is for new records to be added each time a staff/member has a new travel trip. Each new record = new row added below the last record previously added. DateRangeQ_1.png
With the macro, I hope to be able to add each new record to a separate list. This separate list shows those travel records by each individual date and staff/member name. The dates do not need to be in chronological order. DateRangeQ_2.png
So if Mary Jane enters a new business trip to Egypt for 15th Dec to 17th Dec, she will enter a new record in row 9, click the macro button and the macro will generate 3 new records in rows 31, 32 and 33 (one row for one date in the trip).
View 11 Replies
ADVERTISEMENT
Dec 8, 2007
i hv following code
(i use generate macro)
my question is how to arrange the code from one line to multiple like :-
following code show in excel macro environment is one striaght line.
' Create new var on yr , and replace 2006 to CY06.
ActiveCell.FormulaR1C1 = _
View 9 Replies
View Related
Sep 15, 2008
I have data in 2 columns.
COLUMN A COLUMN B
2008-01-01 00:00:00 CRIMINAL EVENT
2008-01-04 00:34:48 OTHER
2008-02-04 00:23:59 SUSPICIOUS INCIDENT
2008-01-31 23:59:59 ENEMY ACTION
2008-01-08 00:45:43 FRIENDLY ACTION
2008-01-09-00:45:33 RAID
I need a formula or macro that will count all the times "Criminal Event", "Other", "Suspicious Incident", and "Enemy Action" occured in January. Also if possible I need to not specify column ranges, such as A2:A7, but instead it needs to find the last cell containing data in Columns A and B, and use that as the end point. For example it would search A2:Last Cell Containing Data
View 9 Replies
View Related
Sep 30, 2009
I have the following code which reads line 54 (row 54) in a spreadsheet and calculates the following using data in subsequent columns. Sometimes the data I need isn't always in row 54, I would rather have the macro read the data in Column A[AB] that is on line 54...sometimes on 53.
The date is Sep-09. How can I make it read this rather than AB54. I think I just need changes @ the top (ie Dim rng as Range, Set rng = [AB54]).
Sub Profile_info2()
Dim rng As Range
Set rng = [AB54]
rng.FormulaR1C1 = "=RC[-12]+R[-1]C[-12]+R[-2]C[-12]"
With rng.Offset(0, 2)
.FormulaR1C1 = "=((RC[-28]+R[-1]C[-28]+R[-2]C[-28])*4)/((RC[-25]+R[-1]C[-25]+R[-2]C[-25])/3)"
.NumberFormat = "0.0"
End With
With rng.Offset(0, 3)
.FormulaR1C1 = _
"=((RC[-15]-RC[-29])+(R[-1]C[-15]-R[-1]C[-29])+(R[-2]C[-15]-R[-2]C[-29]))/(RC[-15]+R[-1]C[-15]+R[-2]C[-15])"
.Style = "Percent"
.NumberFormat = "0.0%"
End With
rng.Offset(0, 4).FormulaR1C1 = "=RC[-8]"
With rng.Offset(0, 5)
.FormulaR1C1 = "=(((RC[-17]-RC[-31])+(R[-1]C[-17]-R[-1]C[-31])+(R[-2]C[-17]-R[-2]C[-31]))*4)/((RC[-28]+R[-1]C[-28]+R[-2]C[-28])/3)"
.Style = "Percent"
End With
End Sub
View 9 Replies
View Related
Feb 6, 2013
I import data from web forms via Excel Web Query which has dates in the US format. I would like to convert them to the uk format. Unfortunately, unlike other data import functions in excel, web query doesn't seem to have an option to choose that. Also after asking the forum via this post, I figured that I cannot use a formula to do this, and need a macro. I recorded a macro which exports text to columns where I choose MDY function to convert the date.
However, the macro doesn't convert the bottom part of the blank cell for some reason. The macro did not work in either modified or untouched versions. When I actuallly do it through excel buttons, it works.
Book3.xlsm
View 8 Replies
View Related
Jan 4, 2008
My problem is I have a sheet thats structured like this:
Purchase # Item AMT
3630130685 10 20,503.04
3630130685 20 12,814.40
I need to add all items of a po to line#1.. is there a easy way to do this??
View 9 Replies
View Related
Jun 11, 2014
I would like to know how can I convert a column P and T that contains these type of number into a proper way of date of DDMMMYYYY.
Like, if the cell in the column P has 8 digits then convert
19830425 -> 25APR1983
19910515 -> 15MAY1991
next cell till end of column P. Then do the same to column T.
View 2 Replies
View Related
Sep 6, 2012
I have dates in Col E that are in mm/dd/yyy. I would like a macro to convert these in the format dd/mm/yyyy.
View 9 Replies
View Related
Feb 12, 2014
As per attached file, there are altogether 4 sub-files and 1 master file.
I'll need the code to automatically pick up the top 9 revenue(highlighted in Green) and top 9 EBIT(highlighted in Yellow) by values in Column N from 4 sub-files and paste to the master file.
Attached File : Example file1.xlsx‎
View 9 Replies
View Related
Jan 25, 2013
I have roughly 3-4 million rows of data that i need to collate for data analytics. I'm using Excel 2010 and saw that the max it will go it just 1 milllion + lines.
View 6 Replies
View Related
Sep 15, 2014
I have two columns containing dates (Date1 and Date2). Date1 is like a long date and Date 2 is a short date. I need a macro to compare these two dates and delete rows where Date1 <> Date2. Please find attached the before and after file which also contains the date formats for these two dates.
View 8 Replies
View Related
May 9, 2014
I have a running list of to-do items sorted by date due (the dates are in the "C" column and start at row 9 to make room for some title info.)
VBA code that would highlight the rows of items that fall in the current week or next 7 days, whichever is easier.
View 10 Replies
View Related
Aug 20, 2014
I need to read or clear all the line in specific range which will be increasing dynamically. Problem is "Selected File List" table range is not specified. New file chosen with browse will be added to "Selected File List" dynamically. Number of file can't be predicted.
vbaStk.JPG
What I've tried so far is, keep track of the browse button click and add the file path to arraylist. After that, (Row number 9 which is start line + arraylist size) to get the number of line of end of the table. But due to some requirement, I want to read the file from excel file. Something like -Read until found blank line or border bottom or something.
I'm new to VBA and I'm not so sure what I'm doing with vba codes
View 1 Replies
View Related
Aug 9, 2014
I have a userform in excel....the listbox "listbox1" has over 1000 items....and i have a label "label5" also.
What i want is if I select for example 10 items from the listbox1 to be shown in the label5 directly....and of course if i select or deselect any item will be applied in the label
For example...selected items from listbox are;
5
6
7
8
9
the label will show me the same
5
6
7
8
9
Code while noting that the list box has many columns...so i want to select which column to be appeared in label.
View 2 Replies
View Related
Feb 19, 2014
I just need to convert a range of cells into a PDF with a macro, is there a simple macro for this?
View 6 Replies
View Related
Jul 12, 2007
Reference the archives at:
http://www.mrexcel.com/archive/VBA/17448.html
How can I modify this sub to skip cells that are empty? I only want cells that are populated within the range to actually display the comment indicator, with the cell text transferred to the comment.
Ideally, I'd also like the text to be moved (not just copied) to the comment and leave an 'X' in the cell, in place of the text that was transferred to the comment, but I'll settle for the action above.
View 9 Replies
View Related
Dec 5, 2007
I have an excel spreadsheet which calculates the count and value of line items based on a report. I use the sumproduct function to calculate this as it involves multiple criteria. The formula is use is
SUMPRODUCT(('Report 50'!$C$2:$C$64992= Dashboard!$B172)*('Report 50'!$H$2:$H$64992=Dashboard!G$2)*(LEFT('Report 50'!$S$2:$S$64992,14)="credit transfe")*('Report 50'!$L$2:$L$64992=15))+SUMPRODUCT(('Report 50'!$C$2:$C$64992=Dashboard!$B172)*('Report 50'!$H$2:$H$64992=Dashboard!G$2)*(LEFT('Report 50'!$S$2:$S$64992,14)="credit transfe")*('Report 50'!$L$2:$L$64992=19))
I think the possible error is coming out of this criteria (LEFT('Report 50'!$S$2:$S$64992,14)="credit transfe")
Out of one particular field i am picking those line items in which the first 14 characters are "Credit Transfe", if i eliminate this criteria i dont get error.
But this is the main criteria for my calculation. Most of the time i dont get any error , but sometines i get the # Name Error? When i double click on the cell it goes to one column. I dont know what to do from there.
View 2 Replies
View Related
May 27, 2009
How could I convert this 'IF' into a VLOOKUP function? =IF(H20 is inbetween 12-14),1,IF(H20 is inbetween 15-17),2,IF(H20 is inbetween 18-19),3,IF(H20 is inbetween 20-21),4,IF(H20 is inbetween 22-23),5,IF(H20 is inbetween 24-25),6,IF(H20 is inbetween 26-27),7,IF(H20 is inbetween 28-30),8,IF(H20 is inbetween 31-32),9,IF(H20>33),10,"")
I know "is in between" is not part of any excel function, just wanted to spell it out for clarity of what it is I want to do.
View 2 Replies
View Related
Sep 23, 2008
First my goal is to sum a row and column. For example i want the sum of row 1 a to row 1 g. However, I'm using a loop for an automated macro. So i want to be able to say something like cells(1, count), so during the loop count goes from 1 to 7 representing the letters in the alphabet. But I'm not sure how to do so.
Secound, in my vba script to pull information from specific pages i say "sheet1.activate" how can i had the sheet switching during the process to speed up the calculation? and last but not least,
If Cells(1, locd) = "2008" Then
When i run my script, i get a runtime error 1004 application-defined or object defined error. The weird thing is, i can move what line it is on and then the macro will run ONCE and then it breaks again with the same error for that specific piece of code.
View 4 Replies
View Related
Apr 16, 2009
I have a spreadsheet, in which I need to lookup invoice numbers from a raw data file with ~5,000 line items on a daily basis. The lookup is based on two criteria searches (1) search product type (2) search product make. In this example, I have 4 product types:
1 – car
2 – truck
3 – boat
4 – motorcycle
For this example I want to search invoices; (1) first search for cars only (2) search for product make. In my attached example, the first item (cell E2) would return invoice number 7147875-FRD from the raw data file. The second item (cell E3) would return invoice number 7147877-NSN.
View 2 Replies
View Related
Apr 30, 2013
I have a worksheet that I need to be able to easily copy and paste the formula/formatting from the row above, but not the Values entered, (if any). I am using columns A to DG.
I just really need to be able to copy all the formula in these cells down - nothing exciting or fancy.
I've tried formatting as a table as per some searches and that was difficult! My column headings changed, and when I inserted a row, two of the formula's wouldn't copy down - plus the shading and borders went wonky in places.
View 2 Replies
View Related
Oct 10, 2012
I know how to create a chart that is linked to another worksheet without a problem.
What I'm looking to accomplish is to create a line chart that automatically updates when new data is entered. So if I were to enter data for October 2012 it would automatically update the chart without me having to manually select the data. I tried the OFFSET tutorials and to be totally honest I get lost so maybe can give me a step by step? Also, I only want to have 15 months of data to show on the line chart at one time. So it should show June-11 to Sept-12 to begin with and once data is entered for October (R) it should update the the line chart to show only July-11 to Oct-12.
I messed with it for about 5 hours last night and got nowhere. About 2 hours today and even watched YouTube tutorials. I can almost get the OFFSET but it's a vertical OFFSET. I tried the horizontal tutorial but it still selects vertically.
View 2 Replies
View Related
Jan 29, 2014
Adding ' in the beginning of a line converts the rest into comment line. I wonder if there is an easy way to convert a huge area into comment line to try something on code. I couldn't find such an option in the menu.
View 2 Replies
View Related
Oct 26, 2012
Every month, I have an import a report to a spreadsheet. At my column A, it supposed to be a date format.
For some reasons, I have a combination of a few cells of date format and a few cells of general format with no order at all.
What I need is: Search in the A column, if date format leave it , if not change from general to date format.
View 2 Replies
View Related
Mar 27, 2013
Extract data with differing date formats that I need to convert to something consistent that I can format as a date.
This is an example of data.... all with general format at the moment.
2/28/2013 2:48:53 PM
1/16/2013 10:48:50 AM
12/17/2012 11:59:49 AM
I have used this formula to extract the date portion, but I can't get this to then format as date. How do I convert this to the julian date, so I can then apply a date format?
=LEFT(G9,SEARCH("/",G9)+7)
(The day portion of this date always has a leading zero).
View 9 Replies
View Related
Oct 19, 2012
I have a spread sheet with a date colume that reads: 2012-06-27-19 I need to have this read like 06/27/2012 but nothing I do is working I have tried to go to the formatting process and backing the hr:mm out and that doesn't work. I really don't want to go line by line to manually correct this issue.. HENCE ... over 2000 lines
Second question: If I have a column that reads 02/15/2012 and another column that reads 3/27/2012 how to a format a 3rd column to make it read total number of days between 1st date and 2nd date?
View 1 Replies
View Related
Dec 21, 2013
I was just wondering what is the formula to convert a date serial number back to an actual date?
View 1 Replies
View Related
Dec 23, 2009
I'm in the military and for maintenance we use the Julian date the format goes as follows "09357" that is simplified as 09 = the year and 357= the three hundred and fifty seventh day of the year. so 09357= 12,23,2009..
so on to my question:
how can i make excel auto convert the julian date to the regular date and vice versa?
View 6 Replies
View Related
Jan 17, 2012
I have these as input entered as text:
January 01, 2011 January 01, 2011 February 28, 2010 May 12, 2011 June 02, 2010 February 28, 2010 May 12, 2011 June 02, 2010 February 28, 2010
but I need it in this DATE format:
MM/DD/YYYY
I need it as a formula to be entered into a cell in excel (not VBA)
View 9 Replies
View Related
Oct 4, 2007
I have an 8 character number that I am trying to segment and change into a date.
The current format is: YYYYMMDD, for example 20071003 (today's date)
I am would like to change it to read 10/03/2007 or another easily identifiable date format.
View 3 Replies
View Related