I made an excell document with many many vba codes/procedures. While creating it, I was doing some tests/playing with the references in the visual Basic Editor.
My problem is now I dont know which ones are necessary and which dont. I want to remove any unnecesarry reference. How can I know which ones are necessary for my project to run properly and which dont?
I need to clean out unnecessary data from a file, (see this example text file Link), I'm not sure how to go about this in excel,
basically every file starts with 9 cells that needs to be deleted, then two cells of real data then one with garbage that needs to be deleted, it goes like that for 40 cells, then again 10 cells of garbage that needs to be deleted, then 40 of real data and goes like that up to 3000 lines,
I know it sounds confusing but if you take a look at linked file from above it will make more sense, (to save it right click on "clean up.txt" and then save target as)
I want to erase all line breaks which I am not using from my work sheet. But still keeping the line breaks which has something written to it.
this as a example of one cell.
------------------------------------------- - Example text number 1 - Example text number 2 - Example text number 3 - Example text number 4 - Example text number 5 ---------------------------------------------
Using "Find & Replace" I got to replace the ones I want to erase with nothing, so its blank. Too bad the Excel doesn't replace the line breaks with it, so this is what I get.
------------------------------------------- - Example text number 1 - Example text number 2
- Example text number 4
The result which I want to have is:
------------------------------------------- - Example text number 1 - Example text number 2 - Example text number 4 ---------------------------------------------
I know about the Clean Function but that function eases all the line breaks from the cell, which I dont want to.
If not that whould mean that I have to delete the line breaks by hand for hundreds of cells.
Basically I have 5 columns from W to AA. Col X and Z have email addresses. Col W has recipients' names. Col Y will either be "yes" or "no". Col AA will either be "yes1" or "no".
When Col Y displays "yes" and Col AA displays "yes1" at the same time, I want to send email to the email addresses in Col X and CC the email addresses in Col Z. The code is doing what I want, except that it sends 2 same emails instead of 1...
Code: For Each cell In Range("X31:Z35").Cells.SpecialCells(xlCellTypeConstants) If cell.Value Like "?*@?*.?*" And _ LCase(Cells(cell.Row, "Y").Value) = "yes" And _ LCase(Cells(cell.Row, "AA").Value) = "yes1" Then
removing duplicate rows and move other data frm rows to columns.xlsx.
I am attaching a sample excel sheet showing what I need to do.In the first tab, I have a list that includes duplicate rows (first column only). I want to remove those duplicate rows but I don't want to lose the data in the following columns which can be unique or duplicates as well.
see the desired result tab in the sheet to get an idea of what I am looking for as the end result.
Keep in mind that the actual source file I am working with could have up to 50000 row, and the expected results could be around 2000 rows. So nothing can be done manually.
Is there a limit on the number of rows and columns that can be deleted in a macro on Excel 2003? I am trying to create a macro that, amoung other things, delets 1119 rows and 54 columns. If I delete the columns first, the rows will not delete. If I delete the columns first, the rows will not delete.
I am working with timesheet data (name, project code, task code, date, hours etc...) in one spreadsheet and rate card data (name, role, day rate etc...) in another.
My task is to pull together some of the information in each of these two source spreadsheets and compile a report. This I have done no problem. However, where a person works on a particular project and task on the same day and records multiple entries (which could be negative) I need to consolidate the hours in all these matching rows and have just one row reflect the total hours worked and delete the other duplicate rows.
So an example would be:
Project | Task | Name | Role | Date | Hours
123456 | 1.001 | Paul Jones | Project Manager | 20/02/2008 | 2.5 123456 | 1.001 | Paul Jones | Project Manager | 20/02/2008 | -2.5 123456 | 1.001 | Paul Jones | Project Manager | 20/02/2008 | 3.5
My problem is I don't think I have approached this the right way but am unsure of where to go with it. The code as is does sort of work but I still get some duplicate and zero lines in my results.
I have a worksheet in which I have sorted the data based in date and numbering (column I and E). I would like to create 2 macros for following actions:
1- all rows with the value "TOM" in column C will have to be deleted.
2- all rows with a value of 601 or 602 in column E, will have to be moved to the bottom of the sheet after the last row with data. The rows that have been moved will have to be sorted based in date (column I) and numbering (column E).
I am working with timesheet data (name, project code, task code, date, hours etc...) in one spreadsheet and rate card data (name, role, day rate etc...) in another. My task is to pull together some of the information in each of these two source spreadsheets and compile a report. This I have done no problem. However, where a person works on a particular project and task on the same day and records multiple entries (which could be negative) I need to consolidate the hours in all these matching rows and have just one row reflect the total hours worked and delete the other duplicate rows. So an example would be:
Project | Task | Name | Role | Date | Hours
123456 | 1.001 | Paul Jones | Project Manager | 20/02/2008 | 2.5 123456 | 1.001 | Paul Jones | Project Manager | 20/02/2008 | -2.5 123456 | 1.001 | Paul Jones | Project Manager | 20/02/2008 | 3.5 123456 | 1.001 | Jo Brown | Developer | 20/02/2008 | 7.5 123456 | 1.001 | Jo Brown | Developer | 20/02/2008 | -7.5 123456 | 1.001 | Sam Smith | Architect | 20/02/2008 | 7.5
Should be processed and come out like this:.......................
I have an imported report in a spreadsheet. It imports to three columns. I need to check each row in column A for three seperate criteria and delete the rows I don't need. I need to delete blank rows and check next row for page header info. Delete these and next rows to next blank cell. Check next row for page header and not delete if not page header. Several rows down will be a cell with 23 blank spaces before the word Reg: and sometimes other words past this but always this first. This row is to be kept. I looked at the FAQ's example of Deleting but I don't think it will work. I also need to put a key word in column A at a point where I want to stop. This report is a couple thousand rows long so a VBA procedure would really save time. I have a procedure I use to check for two zero's in two cells that hide these rows but I couldn't modify it to work on this report.
Need to solve my problem in the thread "Type Mismatch Error Message". Now a new problem has come up in the same code, so - according to the rules - I've started a new thread. (This one is most likely due to my poor knowledge of VBA syntax).
Sub Delete_invalid_rows() Dim i%, j% Dim Nr%, valid As Boolean, BYPdata As Boolean Dim ar1 As Variant Dim ar2 As Variant Dim ar3 As Variant Dim ar4 As Variant Nr = 20 ar1 = Array(11, 14, 19, _ 20, 22, 25, 26, 27, 28, 29, _ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, _ .................
This sheet has A:K columns and 1:3212 rows. There are 'page headers' that are in the text file that I want to delete (the text file was exported from an AS400 program). The first row that starts the page header has SA341 in column 1. Each page header has 5 rows. I used this code from one of the other threads on deleting rows, but I obviously do not understand the code as it deleted all rows that contained SA341. Sub DeleteRows() Column_To_Check = 1 Start_Row = 1 End_Row = ActiveSheet. Cells(Rows.Count, Column_To_Check).End(xlUp).Row MsgBox End_Row Search_String = "SA341" For Row_Counter = End_Row To Start_Row Step -1 If ActiveSheet.Cells(Row_Counter, Column_To_Check).Value < SA341 > Search_String Then ActiveSheet.Rows(Row_Counter).Delete
I am copying a price list from a worksheet. I currently have a script that deletes unwanted rows (products) but these products' header rows' are left. I also want to delete these text based headers. One solution might be a script that reads a columns cell value in the row(s) below and if values are missing the header row should be deleted.
I would like to write a macro button, in order to lookup through col. "D" and where find same invoice number (invoice number combine with 3 letters plus dash), should sum the corresponding rows' amounts in col."J" into one row and the other row should be deleted.
I have a sheet as shown in the picture below. If the cells in Column N has some values that are the result of some calculations. How ever if there are more than one of it, the entire row has to be deleted.
Eg:The value in Column N 816.323 has 3 rows below each other.Only one has to be there.There can be upto 10 values one after other in this way.
I tried to write a progrma by using loops and cehcking if ther is value in the cell,go to cell below and if there is value,delete the row in a loop of 10 times.But it didnt work
I have a workbook where I import data from another workbook. This might get done several times a month. As I go through the imported data I delete rows not needed which gets place into another worksheet. What I need is when I import data again is a macro that the worksheet where my already deleted rows are and compairs them to the new data imported and if the first 13 columns of data matches it delest them off the imported sheet.
I found some code which I altered at [url]
and posted the same question but haven't got any response as of yet.
So the code that i go works but only if the row matches in the exact order on both sheets so e.g. (if row 1 on sheet1 matches row 1 on sheet2) it works but if (row1 on sheet1 matches row 3 on sheet2) it does not.
Here's the code I have so far.
Public Sub delOLD() Dim i As Long Dim iLastRow As Long Dim ws As Worksheet, ws1 As Worksheet
Set ws = Sheets("Data") ' Imported Data Set ws1 = Sheets("Old Records") ' Deleted Data
I wanted to select some criteria based on an AUTOFILTER and then have a macro delete all rows from 2 to the bottom... then SHOWALLDATA pick another set using AUTOFILTER and then having excel repeat and delete everything 2 down... the problem i'm finding of course is that when you AUTOFILTER row number 2 is not always at the top, so I need some relative I think..
I have an excel sheet which has 2800 rows.....The thing is i want to delete a set of rows..consider the following example.....here i need to delete row no 2,6,10....and it continues till 2000......is there a macro to delete the rows....
I am making a resource database at work. we do not have access, we have excel 2003. I need to pull name, address, phone # from a variety of sources and organize it so we can print letters, lists, labels etc. Often the data for on contact takes up multiple rows when you do a large paste. I figured out how to get it all in one row(I use =trim(cell) to place the cell where i want then copy the fuction to all rows I need for each column. then I copy and paste special =values to remove the cell reference) but this was leaves rows with garbage data.
(if ir takes up 2 rows it will be every other row that needs trashing, 3 rows the first row is good but the next two are trash, etc)
question: Is there a way to get excel to automatically remove the junk rows(ie if i select the section Im working on can I get excel to remove every second row?) or is there a better way of doing it so the junk rows dont happen?
Need a code that will delete every row down from my last row used. Say my last value is in row 1000 (this will change everytime) and I need to delete from row 1001 to 65536 (whatever the last row in excel is). I have tired alot of things but can't get it to work.
I have a large design table that I would like to copy the values, open in a new workbook, and then delete any rows with the value of "DELETE" in any column. This is a process that will be repeated many times. The columns with the "DELETES" will be different everytime. There may or may not be mulitple columns with "DELETE"s. The macro needs to be contained in only the original workbook but the actions taken while making the new workbook. Please let me know if this is even possible.
I'd like to find the first used row in a worksheet, and delete all the rows above it.. ie all the empty rows..
To show i am trying, yes i know very trying, i've got this far to find and select first used cell ( code from here) but can't work out how to select the area above..
i've been looking at from r = 1 to FR.Delete, thinking this would do it.. but sadly
Sub FirstRow() Dim Rng As Range, rcell As Range Set Rng = Range("A1", Range("A" & Rows.Count).End(xlUp)) For Each rcell In Rng.Cells If Not IsEmpty(rcell.Value) Then FR = rcell.Select Exit For End If Next rcell End Sub