Having Certain Cells Delete With Macro
Dec 4, 2009
i have a report where information is entered via a macro, i would like the cells to wipe of any data when another cell is clicked
in practice i will have a cell labelled "clear" the user will click it and a message box will promtp " would you like to clear pam sheet" upon the user clickin no of course nothing ill happen, when they click yes certain cells will clear
some are a range and some are individual cells
View 9 Replies
ADVERTISEMENT
Jun 23, 2009
I am creating a macro that pulls data from a pivot table and organizes it on the same sheet as the pivot table. Once I get my data organized, there are several rows that contain data that I dont need and I want my macro to delete this info.
The catch is, since I have the macro placing data on the same sheet as my pivot table I cannot just delete the whole row so I am trying to think of a way to identify the rows that have unusable data and then have the macro just delete the cells in that row without affecting the pivot table.
I used a formula in the last column of my wks to mark unnecessary rows with a "D". Is there a way I can program the macro to identify the "D" and then delete a selected range of cells in that row - and then have it loop through all the rows of the spreadsheet?
View 9 Replies
View Related
Dec 19, 2012
For now, I have data in Column A to E. I have the first row (A1 to E1) contaning different numbers. I need a macro that delete all collumns that cells (in A1 to E1) contain number 1. Next month, I may have 10 columns (A to J) and I want to run the same macro that delete all columns that A1-J1 containing value of 1. The number of columns changes every month, so I want a macro that work to the last column without the need to specifying that column range.
I was using this, but did not work propery (since It just deletet every other column & have to run it a few times to complete & need to specify column range):
Range(A1:E1).Select For each cell in selection If cell.Value>1 Then
Cell.EntireColumn.Delete End If Next cell
View 2 Replies
View Related
Jul 1, 2007
I am looking for a macro that can delete whole rows (shift cells up then). How i would like it to perform is if there is nothing in cell(s) B then delete the whole row?
View 9 Replies
View Related
Aug 4, 2009
i have a column C with thousands of data. in that column, i had done a vlookup formula based on the lookup_value on its right, that is column B. some of the values arent available in the mapping table, causing the #N/A error.
i want to be able to delete those #N/A errors so that my dataset looks 'cleaner'. its tiring for me to go through each row one by one and delete them manually. i wnat to create a macro but im not so sure how to start.
in pseudo-code, it shud be something like this:
delete cell if cell_value = #N/A error.
View 9 Replies
View Related
Feb 11, 2010
I am creating some code to unprotect a workbook, unhide columns, delete a series of cells, rehide columns and then reprotect the workbook:
View 14 Replies
View Related
Sep 3, 2013
I need a macro to delete each row in which all cells contain the same value, always starting in cell G2 and going out an indefinite number of cell's. So, for one run, the range could be G2:BU2 and another it could be G2:PW2. Also, the number of row's is indefinite.
And an added complexity: I need it to ignore the cell in this search process if the cell contains "NC" - so if all the data in the row is the same except for a few that say NC - then it gets deleted. If the any of the cells in the row have other values, then that row does not get deleted - even if it contains "NC".
View 2 Replies
View Related
Sep 25, 2013
I would like code that will delete all rows where there are blank cells in Col D from row2 onwards.
View 2 Replies
View Related
Oct 24, 2007
I am having trouble writing a macro to do the following. Someone had created a spreadsheet a while back that highlighted the cell green and inserted a comment with the person's name and date/time if they changed anything in that cell. The macro works great, but I need a macro to undo the changes.
I would like a macro that will remove all comments from the sheet and revert the cells back to their original color. Since the cells encompass many colors, at the very least, I would like the macro to remove the comments and make the cells the default shading (white).
View 9 Replies
View Related
Aug 1, 2014
I have an excel file, where there is a section "Additional Requirements". This section is repeated like 20-25 times in the sheet and has a group of merged cells below it to enter data as shown in the picture. Issue is that majority of these "Additional Requirements" are not filled by the user. Hence maybe only 3 or 4 are filled and I have to manually delete the rest. I tried the code below, but it doesn't do anything.Running the macro just jumps the cells slowly downwards the sheet. Maybe if the macro runs 10-15 times it reads the whole code and then moves on to the next row.8-1-2014 12-43-27 PM.png What I'm trying to achieve is:
1. for the macro to find "Additional Requirements"
2. Then check the Merged cell below it (thus the offset)
3. If this cell is blank, select this cell and the cell containing "Additional Requirements"
4. Delete entire rows of these cells/delete the selection (entirerow.delete). (I read somewhere to set a variable as selection and clear it, hence ive included in the unreadable code. This wasn't working either)
View 4 Replies
View Related
Mar 7, 2014
Each day I am going to have a list of about 300 different ID numbers, which i have already got a macro for creating, that outputs them into a single column on a sheet.
The next challenge Ill face now, is that I'll have a list of maybe 500 ID numbers in another spreadsheet.... I need a way to basically tell excel to keep rows that contain the numbers in 1 column on the list of 500, that correspond with those on the list of 300.
Numbers that are not found on the list of 300 ID numbers, must be deleted, along with the entire row.
I essentially need a macro that runs something like this that i found online, but instead of it just looking for the word "apple" as rows to delete, i would need it to check to see if the number is one of the 300 on my list.... and delete the row if it is not on the list
PHP Code:
Sub Delete_Rows()Dim rng As Range, cell As Range, del As RangeSet rng = Intersect(Range("A1:C20"),
ActiveSheet.UsedRange)For Each cell In rngIf (cell.Value) = "Apple" _ThenIf del Is Nothing ThenSet del = cell
Else: Set del = Union(del, cell)End IfEnd IfNext cellOn Error Resume Nextdel.EntireRow.DeleteEnd Sub
View 3 Replies
View Related
Nov 26, 2008
how i might create a macro to attach to a button so i can delete the contents of all VALUE! cells. Either this or have a script in the background so no cell will return VALUE! (or any other error if possible)
I know if i had all the formulae sorted they might not butit's quite a large spreadsheet. The reason for the VALUE! error is text in cells that the formal points.
View 2 Replies
View Related
Mar 5, 2009
I'd like help in creating a macro that deletes an entire row that has emtpy cells in col B, C & D in the same row.
So for example if I have empty cells in b3,c3 & d3 I'd like the row deleted.
I've used the code below for just column B but I need to include column C & D as well. I tried putting Columns("B:D") but it deletes everything.
View 14 Replies
View Related
May 29, 2013
I need it to clear the contents from the cells, then copy a number of sets of cells from selector, paste them in to AM call plan and then delete the duplicates. My code is getting stuck very early in the whole thing. The copy, paste sequences, were originally recorded as a macro, then added to trying to get it to work.
Here is the code, and the red line of code is where it is stopping:
Sub Call_Plan_Targets()
'
' Call_Plan_Targets Macro
'
Dim LR As Long
Application.ScreenUpdating = False
LR = ActiveSheet.UsedRange.Rows.Count
[code].....
View 1 Replies
View Related
Oct 3, 2013
Creating a macro. Need to delete records in column D from the first blank cell. 1st blank cell variable.
View 9 Replies
View Related
Apr 27, 2012
I am using Excel 2010 and I need a macro to delete all text from cells and leave the dates.
Below is an example of the contents of six cells. Some have just text, but some have text and dates.
1st Time Attender: 4/8/20121st Time Attender:1st Time Attender: 4/5/20122nd Time Attender:2nd Time Attender: 4/8/20122nd Time Attender: 4/5/2012
In this example, I would want the new cell contents to be:
4/8/2012
4/5/2012
4/8/2012
4/5/2012
View 1 Replies
View Related
Jun 19, 2009
I want to delete a sheet in a macro but when I run the macro, I always get a message warning and I have to answer the msg box to delete the page. Below is the macro command I am using.
Sheets("Tel").Select
ActiveWindow.SelectedSheets.Delete
View 4 Replies
View Related
Feb 7, 2008
I have recently grabbed the very helpful "Macro to delete VBA code" from this site, and it's working but with one small problem.
My worksheet runs a lot of code, then deletes all macro code and saves itself.
The problem is the next time i open I still get the macro security warning!
I've checked thoroughly and there is definatley no vba left anywhere.
If I open the document, enable macros, and save it, then open it again, I no longer get the warning.
View 9 Replies
View Related
Apr 26, 2013
Any way of deleting all rows not containing particular text? I did it as a loop but it took forever and I had to run it several times because it kept jumping over values. There must be a simpler way, I just can't think of it yet! still new to VBA.
Dim DateColumn As Range
Dim cell As Range
Set DateColumn = ActiveSheet.Range("a2:a623")
'remove unwanted rows (not = M XXXX MTD)
For Each cell In DateColumn
If Not cell.Value = "January 2013 MTD" Then
cell.EntireRow.delete
End If
Next cell
View 7 Replies
View Related
Feb 22, 2014
I would like to empty cells (not delete a row) that contains in column B values that are like Paper. In this cells are different materials (PVC, paper, steel, wood, glass) and also paper have different names (Paper 50g, Paper 80g, Paper 120g,...). I want that all that cells in column B that contains (Paper) are empty.
Before:
A
B
1
548787
Paper 80g
2
646411
Steel bar
3
634211
Steel pipe
4
521446
Paper 300g
5
521424
Paper 180g
6
...
After:
A
B
1
548787
2
646411
Steel bar
3
634211
Steel pipe
4
521446
5
521424
6
...
View 7 Replies
View Related
Apr 3, 2014
code that will find the last row of data, delete all cells, and move them to the left.
Please see below:
BEFORE
After
1
ABCD
Frank1
[Code]...
View 3 Replies
View Related
Feb 10, 2008
I have a workbook with parantheses in each cell. The contents are text and an example is;
Basketball-WNBA (71)
I want to delete the (71) from every cell. The numbers are NOT the same but will always be at the end with () around them. How can I do this without going to every cell? There are about 40,000 cells in the workbook..
View 9 Replies
View Related
Jul 8, 2007
I have used Vlookup to search and to return specific values to column 77. For those values that are not defined, Vlookup will return #N/A ( null value). Can I know how to write a macro that can go through each cell in column 77 and delete those cells that have null value? I tried the following code but it doesn't work
Sub clear_contents()
Dim rwindex, colindex
colindex = 77
For rwindex = 658 To 663
With Worksheets("Invoice").Cells(rwindex, colindex)
If .Value = Null Then
Worksheets("invoice").Cells(rwindex, colindex).ClearContents
End If
End With
Next rwindex
End Sub
View 6 Replies
View Related
May 15, 2014
I have date from column a to k
I have a formula on column L
I want macro to delete all rows with #N/A
View 5 Replies
View Related
Dec 20, 2006
Need a macro for the following situation, will be incorporated into my other macro.
For each row in column C,
if value for first 4 letters = "abc " or "def " or "ghi " or "jkl " then delete entire row.
View 9 Replies
View Related
Aug 30, 2007
I'm looking for code that will prompt a user to select column(s) to be deleted.
- With the exception of columns A,B,C.
- Only entire columns can be deleted
- Rows can not be selected for deletion
View 9 Replies
View Related
Oct 23, 2008
I want to delete a row if it contains componenten.
In here i ask to delete componenten not.
Or should i take "*componenten*" or totaly someting else
For MY_ROWS = Range("c65536").End(xlUp).Row To 1 Step -1
If UCase(Range("c" & MY_ROWS).Value) = "COMPONENTEN" Then
Rows(MY_ROWS).Delete
End If
Next MY_ROWS
View 9 Replies
View Related
Jun 10, 2009
Have a sheet that has a $ value in Col J would like to run a macro that would delete the Row if the value is $0.00 and move the rows up.
View 9 Replies
View Related
Oct 27, 2009
On a daily basis I populate data on different worksheets. Meaning on each day I have to delete T-2 data to populate T-1 data.
I would like a macro to select a date to delete rows from each worksheet containing the date in Column A of each worksheet
View 9 Replies
View Related
Jan 9, 2007
I have a macro that I would like to remove itself from the file as its last action. I don't want a warning message re file containing macros to show on opening the file.
View 9 Replies
View Related