Every day we extract data from a billing system and we import this data into Excel (customer names & invoices amounts). What i'd like is a VBA code that inserts a new row after every different customer and calculates the total amount for this specific customer.
See a simplified example below :
Customer 1
52.25$
Customer 1
154.25$
[Code] .....
What i would like is to have a row added after Customer 1 and then having a total amount of his invoices in this row. Same thing for Customer 2, 9 and 14.
I have a userform that I'm using to add data to a worksheet, with the following
Private Sub CommandButton1_Click() Dim OutSH As Worksheet Set OutSH = Sheets("Sheet1")
OutSH.Cells(nextrow2, 1).Value = Surname.Value OutSH.cells(nextrow2,2).value = ID.value OutSH.cells(nextrow2,3).value = Date.value ...... I need to ensure that duplicate entries are not made for the same person on the same date. The ID is unique to each person.
IF statement that can check for a duplicate and then come up with a dialouge box with some custom text, and then exiting the sub?
Using =A7&","&B7 to add data from two columns into one, separated by a comma. What about multiple columns, still separated by a comma? See Example in attachment.
I am trying to have a form post the data on the next available row. If all of the rows are filled, there is no issue. However, what I am trying to do is set up a workbook that will remove the data in a row, but than is able to replace that row with more data.
I have got a spread sheet (Attached) that works out the rankings of youth football teams so that they can be given fixtures against teams of the same ability. I want to use the same system for another age group which has nearly 100 teams in it but I can't get it to work for over 50 teams.
With my basic Excel knowledge I have worked out how to add extra columns with the correct formula, but I can't work out how to add rows with the correct formula to the table that is in cells A12 -C12 down.
Ideally I would also like this table to show the team with the highest ranking in position 1 & in descending order from there - but I would be more than happy just to add the extra rows for now.
I have a workbook with 18 columns and 9000rows for each column,
All I want to be able to do is ad a"," (Comma) in each cell at the end of what ever is in each cell.
Tried looking in the help of excel, but if you can't write in properly what you want, it doesn't give you the answer of how to do this in the help list
I have rows labeled by days of week and columns by different departments. I need to add the data from Saturday and Sunday to Mondays data and then delete Saturday and Sunday. Also need to do this for some 800 days
I need the peices and hours total for each name on another sheet. So I would have John on my sheet and would need to to grab and add the info from B2 & B6 into one cell (since it is the same person). I can always drag the info over for hours once I find a way to do this for the pieces I would think. The problem is that I don't want to add in B1 & B2 for John because those numbers are not a part of the total.
So is there a way or formula for one cell to look at the entire sheet and everytime it sees the name john to add the information one column over and one cell down and then give a total?
I may be able to do some formatting and have all the info I need directly to the right. So I would have (A1) John, (B1) Data, (C1) Data. The issue would be a cell finding the name, taking the information directly to the right of it and adding it as many times as the name is found on the sheet.
I have two excel sheets in the same workbook. I've linked column B2 in Sheet1 with column A1 in Sheet2. It works great!
The only problem is that when I add a row in Sheet1, it appears in Sheet2, but the rest of the data on that sheet doesn't move alongside the rest of the rows. So if Sheet2 looks like this:
Abby 16 Amy 15 Jenna 14
And I add in another name in Sheet1, lets say Ben, then Sheet2 will look like this.
Each week I get new weekly data-metrics. I have a series of formulas that figure LAST 4 weeks average, LAST 8 weeks, etc etc. How do I drop in a new week of data and have my formulas adjust? For instance, my formula figures last 4 weeks average of May Wk 1, May Wk 2, May Wk3, May Wk4. Now it is June Wk1, so I want to figure (without changing any formula) May Wk 2, May Wk3, May Wk 4, June Wk 1.
I have created a excel program with two workbook. Workbook1 holds all the userform to add data Workbook2 is the database Basically I store all data to WorkBook2 through userforms in WorkBook1. So far to add data to database(WorkBook2) I open the workBook2 along with WorkBook1 and close it when I close the WorkBook1. and working perfectly.
Is there any way to put data into WorkBook2 without opening it. Application.Screenupdating is not not my choice.
I am trying to re-use it for a very similar purpose. I now have three sheets. The data from Sheet2 has already been imported due to the code I was given below. I am now trying to import data from Sheet3. The function needs to copy all data from sheet3 to sheet1. However, if there is already an entry that contains the same name, location and type (I.E. it was imported from sheet2 and created rows), then the data from sheet3 needs to be added to those same rows. If there is not an entry, I want the code to add new rows beneath.
To summarize, I need to pull in data from Sheet3 which contains Location, Type, D Length, E Length, Z Length. If there is a row in Sheet3 that contains the same unit (G2K_G2_FB1 for example), location, and type in Sheet1, the data needs to be added to the same row in Sheet1. If Sheet3 has a new location or type, it needs a new row added in Sheet1.
[Code] ....
I have attached a sample workbook. Temp_backup - Copy.xlsm
I'm attempting to create a macro (1st time) that will copy data from one worksheet and paste it into another. The problem I have is that I need to run this multiple times so the pasting event needs to occur on a new row each time. As it is, I can only paste new data over existing data, so I need code to find the next empty row. Here's what I have so far, which obviously doesn't work:
Every day i have to pull of a text document from a server and import it into excel so i can change the format of certain columns. Then import the data into a database. I am trying to create a macro that will enable me to make these changes instantly without having to spend minutes on them.
There is once column that has the format 2009-03-12-10:02:09 which indicates date and time however there is a - inbetween them. I know that i can use =DateValue(left(a1,10))+ Time alue(right(a1,8)) and then format the cells to date and time to remove the -. My issue is that i only want to use the formula upto the last row of data otherwise i end up importing blank rows into my database.
I'm having an issue with adding data to word from excel through VBA.
I would like to add the Table to the word doc, then copy and paste data below it. The code works fine. However, after the table gets added to the top of the word doc, the rest of the stuff begins pasting from the top of the doc, causing the table to appear at the bottom...
I have a workbook which is used to merge new customers data into letters and then monitor the progress of the job through to closure. I have a worksheet (New Jobs) where new jobs are entered which acts as the db for the word document and have assigned a macro that appends all new jobs to the monitoring worksheet (WO Open). I have 10 cells in WO Open worksheet to the right of the new data that I need to populate with formulas.
I've a worksheet with 36 columns to keep track of a football confidence pool,I've a CF in which a W is entered in every other column from B1:AG1 and it highlites the whole column yellow,in column A is all players names,from column B2:AG2 I enter the 32 NFL teams,in row B3:AG3 I enter points from 1-16,in column AI it adds all numbers in yellow per row which gives me a weekly score,in column AJ I've the players name and there year to date points and finally in column AL it ranks the players by highest point total.
I will use this on a weekly bases for 16 weeks,what I need is for column AJ to keep adding the players points once I delete there respective numbers from rows B3:AG3 and add new ones for the following week.
Formula in cell AI3 =sumif($B$1:$AG$1,"W",$B3:AG3) copied down Formula in cell AJ3 =A3 & " " & AI3 copied down Formula in cell AL3 =rank(AI3,$AI$3:$AI$8,0) copied down I also have the following macro an my sheet which allows me to use the formula in column AI3. Function ConditionalColor(rg As Range, FormatType As String) As Long 'Returns the color index (either font or interior) of the first cell in range rg. If no _ conditional format conditions apply, Then returns the regular color of the cell. _ FormatType Is either "Font" Or "Interior" Dim cel As Range Dim tmp As Variant Dim boo As Boolean Dim frmla As String, frmlaR1C1 As String, frmlaA1 As String Dim i As Long
I want to total cells that have data in them across a row. I have a name in Column A and then in Columns C-Z I have data. In Column B I want Excel to scan across cells C-Z and if a cell has data in it (it will be text) I want it to add one to the total in cell B. Would CountIF do this with text involved?
I was hoping to force end users to use a user form to input data into a work sheet. The problem is that the form wont input the data when the sheet is protected.
When you run the below macro from my orders.xls file it opens my template.xls file and writes data to specific locations and saves the file as the order number from my original file orders.xls. Now for single item orders which are located on the 2nd row there is no problem, but for multiple item orders which each item is on its own row it overwrites the first order because the order number is the same.
Here is the macro and in comments is an example of what I'm trying to accomplish.
Sub PackingLists4Protocol() ' Protocol flatfile ProtocolOrders.xls translated and creates files named by order number ' CSV ONLY ' Keyboard Shortcut: Ctrl+P
I am just starting to learn about VBA and I have a range of data from collumns A through R. I would like to develop a macro that would place a time stamp in column S whenever the data is modified.
I have spreadsheet with some very basic formulas that work out sale prices based on people entering buy prices. (It works out the % margin). There are certain areas where the user enters the data - and does not touch any other part of the sheet.
What I am trying to do is add a button which will remove the data from these cells. Almost - a start again button or refresh button. This way it will remove previously entered data - without removing formulas from the cells where the calculation happens. So basically there are cells that a user will enter data - and it is these cells I would like to be able to clear with a button or similar without affecting other cells.
I've got a problem involving several Dim'd Variables needing to be added up, they're all Dim'd as Variants though as they can be either strings or numbers at any time.
I need a formula (VBA) to add them up (to add their actual numeric values - not just a "1" if they contain a number) and ignore them all together if they contain string values.
I have multiple sheets (Sheets "A", "B", "C", etc) with the same structure and formatting. For these sheets ("A", "B", "C", etc.), I want to create dropdown lists in column F (cells F2:F100) based on values from a different worksheet (Sheet "DropDown", Cells "B2:B130").
I saw a previous post [URL]... which had a single sheet example. I am trying to come up with vba code for multiple sheets and so far it's not working.
VB:
Dim wkst As Worksheet For Each wkst In ThisWorkbook.Sheets ThisWorkbook.Names.Add Name:="listdata", RefersTo:= _ "=dropdown!$B$2:$B$130" With wkst.Range("F2:F100").Validation .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=listdata" End With Next End Sub