Code To Clear All Contents In Columns With Specific Text In Row 2
Jul 29, 2014
Below is my initial code that can't get past the first line.
if right(cells(2,i),4) = "D_MA" then ..... ?
I'm trying to clear the contents of all data in each column that has the text conaining "D_MA" in that columns row 2. For instance, if cell F2 has 30D_MA, I want the macro to clear all contents in Column "F" -- but to do this for all columns that contain "D_MA" in row 2.
View 8 Replies
ADVERTISEMENT
Jul 3, 2014
I am currently using this Code to search column1 for a Key Word that is entered into textbox "Kunde" on my userform.
[Code] .....
What i would really like to be Abel to do is :
Search for the cell in column1 with =Kunde.Value
Clearcontents of this cell and the 2 adjacent to the right.
i.e. Word is found in A7
Cells A7:C7 contents are cleared and fill Color returned to default colorindex 0
View 3 Replies
View Related
Jul 3, 2014
I have a range of cell content to be clear (Value only) but no formula in those cell.
The range is populated in cell H106.
Example cell
if cell H106 = D5:E102 then clear the value value only in cell range D5:E102
if cell C106 = G5:H102 then clear the value value only in cell range G5:H102.
View 8 Replies
View Related
May 20, 2009
I have a small workbook that copies 4 cells to a database list as per the code below, 2 of the fields activate a pop up calendar for date input on a button push the data is transfered to the sheet and the cells are cleared, however on the clear contents parts at the bottom of the code it reactivated the pop up calendar,
is there a way of not having this pop up when clearing the contents.
View 4 Replies
View Related
Sep 15, 2009
This code is supposed to clear the contents of row 6 cell if the contents of row 5 cell is blank/cleared. I get an error on the "If Intersect" Line. What's wrong?
View 4 Replies
View Related
Sep 12, 2012
Small piece of code to clear the contents of
Rows 33 thru 100 , then
Rows 142 thru 209 , then
Rows 251 thru 318 , then upto
Rows 43524 thru 43591 then finish
View 5 Replies
View Related
Apr 19, 2013
I have set up a macro to clear data in COl A from row 2 onwards. I need to amend the code to clear the data in the following columns from row 2 as well
Col C to I and Col L to O
Sub ClearData()
Dim LR As Long, i As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For i = 2 To LR
With Range("A" & i)
.ClearContents
End With
Next i
End Sub
View 4 Replies
View Related
May 2, 2008
I have created a desk planning spreadsheet in excel. Each week a mailmerge sends out an email to everyone in the office asking them to confirm when they will need a desk in the next week.
As the normal employee doesnt get involved in desk planning I want them simply to state whether they will be in the building or not by entering "GH" (our building) in a cell under each day in the email they get sent.
When the reply comes in we select the cells from the email and then paste them into the desk planning spreadsheet.
-----
WHAT I NEED TO DO:
Select some cells (must be in the same row - that we have just pasted in).
Press a button on the Worksheet labelled "Auto Assign Desk", which does this:-
For each cell that contains "GH", replace with the right-most cell to the left of the selection that starts "GH_"... (this is the start of a unique desk reference (GH_1_1, GH_1_2,etc.)
-----
This will assign the employee to the desk they were sat at last, when they are in the office next week.
View 7 Replies
View Related
May 10, 2014
I have a userform where the user will identify a record to delete. I need to search another worksheet (Month) for the event's name which is associated a date. Once it finds this event's name I need to clear the contents of that cell.
Here is the code I am using for the record deletion from the 'Data" worksheet. I need to also locate and clear the cell as stated above.
View 1 Replies
View Related
Feb 18, 2009
Been racking brain, searching through the forum here, and my Excel 2003 Bible all day trying to figure out this problem to no avail. I would like to clear the contents of any cell in a given range if the cell immediately to the right of is formatted as bold.
View 2 Replies
View Related
Jan 12, 2012
I frequently review DAT files. These DAT files use a variety of characters as delimiters. I'm trying to devise a macro that will perform a text-to-column operation, using the content of a specified cell as the delimiter.
Here's my code, which uses - (ASCII 0254) as a delimiter:
Code:
With Sheet1
Range("A1", ActiveCell.End(xlDown)).Select
Do
[Code]....
Instead of having the delimiter hard-coded, I'd like my macro to use whatever character I enter into Sheet3.Range("i5") as a delimiter. That way, I can easily change my delimiter character as necessary.
View 4 Replies
View Related
Feb 5, 2010
i am trying to use clearcontents with the below code but i get an error,
With Sheets(1)
With .Range("J7")
.ClearContents Range("J7:J" & .Range("A" & .Rows.Count).End(xlUp).Row)
.Formula = "=H7-I7"
.AutoFill Range("J7:J" & .Range("A" & .Rows.Count).End(xlUp).Row)
End With
End With
View 9 Replies
View Related
Sep 10, 2013
I want the function of clear contents to work based on the value of B4. If I run the code with clear content part excel crushes.
VB:
Private Sub Worksheet_Change(ByVal Target As Range)
If Range("B4") = "Basic" Then ''*** B4 is adropdown ***''
ActiveSheet.Unprotect
'Range("B10,F10,H10").ClearContents ''*** if I run this part the excel crushes ***'''
Range("B10,F10,H10").Locked = True
[Code] .....
View 4 Replies
View Related
Feb 10, 2010
I am looking for a way to remove text from a cell if it is 2 characters or less but do nothing if the text is longer than that. Is there a way to do this with either a function or an advanced find?
For more detail, I have a list of middle initials and last names. The cells are either a middle initial by itself like "D." or they are a last name like Jones. I want to go through and delete the cells that have the middle initial and leave the ones with the last name. So if there is a function that will evaluate the cell, and if it is 2 characters or less, then delete the contents. If greater than 3, leave it alone.
View 3 Replies
View Related
Mar 6, 2014
I think I've had enough of using excel generated macro's as an excuse for decent code. I need to turn this:
Small procedure, function, what have you that will continue this pattern until I hit some kind of indicator to tell it to stop. This just clears the contents from 7 rows, hops down 9 rows and does it again.
View 14 Replies
View Related
Dec 2, 2011
I have a monthy activity where I would like to clear the area B13:P42 on various worksheets in the same spreadsheet. Is there an easier way to do this rather than just recording a macro?
View 5 Replies
View Related
Jan 17, 2012
I have the following code where I want to clear the cells.
Code:
Workbooks(strOutputFileName).Sheets(2).Activate
Range("F9:F25,C27:E57,F59:F60,J9:J25,G27:I57,J59:J60,N9:N25,K27:M57,N59:N60,R9:R25,O27:Q57,R59:R60").Select
Selection.ClearContents
When I run this code, where it should select G27:I57, it instead selects G27:N57!!!!
When I manually try to select the G27:I57, the selection jumps to the right to N57.
When I use this piece of code on a different worksheet, it works OK!
View 6 Replies
View Related
Jan 21, 2012
Macro to clear contents of entire row if any cell in Range A2:A17 is Empty.
View 9 Replies
View Related
Feb 27, 2012
I am trying to have a macro clear out the contents of a cell before it quits, the cell contains validation data in the form of a list. My goal is to force the user to choose an option every time before exporting a file, the cell contains what will become a part of the filename. I want to make sure the user, usually me, remembers to change it each time rather than accidentally saving over another filename. I had the following code and kept getting a 400 error (nice and specific)
Code:
ActiveSheet.Range("O3").ClearContents
The only way my macro will run without a 400 error is if that line is commented out. Is there any way to clear out the cell and retain the validation data dropdown list?
View 1 Replies
View Related
Jul 30, 2014
i have a vba that clears content from specific cells, hence somehow it also deletes the header as well
This is my code:
Dim LastRow As Long
Sheets("All").Select
LastRow = Range("J" & Rows.Count).End(xlUp).Row
Range("A2:J" & LastRow).ClearContents
Sheets("All").Select
LastRow = Range("AO" & Rows.Count).End(xlUp).Row
Range("AI2:AO" & LastRow).ClearContents
View 9 Replies
View Related
Aug 20, 2008
I'm trying to figure out code to have only the contents of cell 'a2' cleared when the contents of cell 'a1' is changed. The issue is that both cells are derived from lists and I don't want the formats cleared.
View 9 Replies
View Related
Apr 8, 2009
I dont know how to copy an excel sheet into the question.
But assuming the following text starts at CELL C2 (this is just a section of the workbook)
C D E F G
1x55Correct!
2x55Try Again?
3x55Try Again?
4x55Try Again?
5x55Try Again?
This is a worksheet to test multiplication tables. I am trying to create a macro button to clear the contents of column F, for the kids to start again?
View 9 Replies
View Related
Sep 30, 2009
I need code for a macro that will find a min value in a particular column and based on that min value clear the contents of other cells for that min value.
For example, I have dates in column E such as:
200907
200906
200902
200809
200803
200710
200707
Therefore, I need to find all records for 200707 and clear the contents in other cells.
I can't hardcode the min date because that can change from month to month when new files are created. As can the number of rows.
I'm using Excel 2007.
View 9 Replies
View Related
Jul 18, 2006
I have a protected worksheet in which certain calculations are performed based on certain inputs.
For example, let's take Column E:
Starting in cell E4, I have cells in that column which are input cells and further down the column are calculated cells which are locked and whose formulas are hidden.
I was looking for a macro which would go down col E and clear contents of all unlocked cells without messing up any of the protected cells.
Also, there are certain cells in which I want to clear contents and some cells that I want the macro to insert a "0" value.
The input cells are non-contigous.
View 7 Replies
View Related
Mar 7, 2007
Is it possible using vba code to clear a specific cell's contents? I have a workbook that has text boxes that need the linked cell cleared when the workbook opens so the user can start fresh with empty text box's.
View 6 Replies
View Related
Apr 24, 2007
I've been pressing on with my project and figured out that I really do not know the difference between Deleting and Clear contents. I really thought they were the same but am now unsure. I guess I have 2 questions. Which is better to use? what I'm doing is removing old data and importing new data. and which is more efficient for writing code.
Sheets("Bodies"). Range("A2:Z65000").ClearContents
Sheets("bodies").Range("a2:Z65000").Delete
View 6 Replies
View Related
Jun 18, 2014
I have a row (will always be row 3) where each cell contains a day of the week, the days repeats for a year or so, making the row almost 400 cells.
Like this,
Mo - Tu - We - Th - Fr - Sa - Su - Mo - Tu - We - Th - Fr - Sa - Su - and so on...
Though, A3 doesn't have to be "Mo" because the days in this case can change (A3 can start with "Tu"), hence I think I need a macro.
So if this row contains a weekend, "Sa or "Su" I want all the cells in the column beneath that which contains a specific value to be cleared.
Example, if "Sa" or "Su" has 3 values in the columns under them, all the values that contain "X" or "Y" has to be cleared.
Like this:
Rows (1,2,3...,)
1----
2----
3 Mo - Tu - We - Th - Fr - Sa - Su - .. and so on..
4 A --- B --- X --- Y --- X --- B --- Y
5 A --- B --- X --- Y --- X --- X --- X
6 A --- B --- X --- Y - --X --- Y --- C
After the macro it should be:
1----
2----
3 Mo - Tu - We - Th - Fr - Sa - Su
4 A --- B --- X --- Y --- X --- B ---
5 A --- B --- X --- Y --- X --- ---
6 A --- B --- X --- Y - --X --- --- C
Notice the two examples in the excel file.
Excelforum.xlsx
View 6 Replies
View Related
Oct 24, 2008
I am trying to write a VBA code in excel to delete any columns when a cell in that particular column = 0 (zero). That cell would start at B19 and subsequently follow to C19, D19 and so on.
View 9 Replies
View Related
Dec 14, 2013
i have attached a template spreadesheet that 20 people uses everyday. The template works fine but what i would like to do is write a code to clear all the content that manually entered beforeclose. For some reason code is not working properly because when i wrote code to clear the contents the buttons don't work . I also attached the spreadsheet.
View 4 Replies
View Related
Apr 24, 2014
I'm playing along with Excel. I discovered it doesn't like cutting and pasting in VBA. This screws up formulas in cells.
It much prefers copying and pasting. So this involves an extra step, going back to the cells you just copied and clearing them.
So I have a selection of cells and I just copied them to a different location. Naturally the location I just copied it to then becomes selected.
I would like to go back to the cells that have the dotted selection around them and clear them. If I simply use Selection.ClearContents it will clear the currently selected cells, NOT the dotted selection.
Command to clear the contents of the dotted selection?
View 4 Replies
View Related