Macro To Clear Certain Cells In Row If First Cells Date Is In The Past
Apr 9, 2014
I would like to run a macro that would check if the date in the first cell of row is in the past.
If yes, then it would clear contents of cell in B,C,F,I,L of the same row (PLAN + SHIFTS). Or even better it would set them to 0 (zero).
Then it would hide the entire row. Is this even possible?
Please see the example: Excel.JPG
View 8 Replies
ADVERTISEMENT
Mar 2, 2008
I currently have a sheet that shows monthly tasks and their due dates. There is also a control that when clicked, resets the due date to the following month of the same day.
What I would like to do is setup some type of reminder such as either flash the due date cell if possible or change the fill color. It should do this when the system date is = to or 4 days before the due date.
The only way I can see doing this is using VBA, which I do not know very well.
View 3 Replies
View Related
Jan 22, 2013
Macro to clear cells with numbers but no cells with formulas with in this macro:
Dim i As Long
i = Range("E3")
If i > 0 Then
' Copy range
Range(Cells(6, 10 + i), Cells(500, 17)).Copy
Range(Cells(6, 10), Cells(500, 17)).Select
' Paste special
ActiveSheet.PasteSpecial Format:=2, Link:=1, _
DisplayAsIcon:=False, IconFileName:=False
' Clear i columns on the right
Range(Cells(6, 18 - i), Cells(500, 17)).ClearContents
End If
End Sub
The range is where the cells with numbers need to be cleared but not the ones with formulas.
View 2 Replies
View Related
Oct 1, 2006
i created a work sheet with the help of the wonderful people on this forum. my boss loved it! one problem they now want it to automaticly take out a date and time of the cells when the date rolls around again.
example:
12/25/05 late 00:20:06 when 12/25/06 rolls around they want the system to automaticly see it and delete it out with the amount of time they were late or sick ect.... or if the sup was out that day and comes in the next day the system will see that the date has past and will up date the info. the other catch is i need it to move everything up one space when it deletes somthing. i want it to read j18 and k18 as one and so through j and k 40 same for l and m n and o ect.... i attached the sheet
View 9 Replies
View Related
Nov 30, 2006
I have data in columns a,b,c and d from row 1 to about 200 right now. Every week another 9 rows are added. I wanted to create a macro that will delete the last 9 entries in each column.
View 9 Replies
View Related
Jun 5, 2009
if I had text in column A, I would like to clear all the cells to the right and leave the text in column A.
Also, if I had text in column A and B, I would like to clear the cells to the right.
View 9 Replies
View Related
Jan 26, 2009
My Workbook with a macro to clear ONLY the highlighted Cells.
The Highlighted Cells can be found on the sheet "Line 5"
View 11 Replies
View Related
Jul 8, 2013
I am looking to create a macro to copy sheet Day(1) and call it Day(2). I would like Y3 to increase one day with the date, I would like Y4 to increase day and 1 and clear data from G35-G65.
View 4 Replies
View Related
Oct 8, 2013
I'm trying to create macro that will clear the contents of the cells in the 4 columns to the left of a cell that = 0 %, as well as the cell that = 0%. For example, if cell F13 = 0 % then the contents of B13:F13 would need to be cleared. The range in which data is being pasted into is B13:F27.
View 4 Replies
View Related
Jun 22, 2009
is there a way to do this in VBA? I've also read: - Dave Hawley's recommendation of using: Sheet1.UsedRange.SpecialCells(xlCellTypeConstants).ClearContents
from another thread (which is excellent!)
- SHG's recommendation of using a named range, for example:
Range("Inputs").ClearContents
Given my limited knowledge of VBA, how would I now combine the two to write a VBA sub-routine that clears a named range entitled "Entry" on a sheet entitled "Data"? Would the following be the correct syntax: Worksheets("Data").Range("Entry").SpecialCells(xlCellTypeConstants).ClearContents
View 6 Replies
View Related
Oct 31, 2008
This is a project plan with tasks and dates. Column A is the activity number. (Example 1, 2, 3" etc). Column B is the task (Ex. "Complete Report"). Column C is number of days required to complete the task. Column D is the dependency column. (Ex. Cell D2 =1 in other words Task 2 is dependent on task 1). Column E is the date.
I would like to have a seperate start date cell and a go live date cell.
The objective is to enter a start date, and have each column E date increase based on the number of days entered in Column C. If a task is dependent on another and I change the number of days in Column C I need the dependent task to change the same amount of days.
View 9 Replies
View Related
May 28, 2009
I am looking for a code that will clear all of my unlocked cell in sheet 1. That is not a problem but since many of the cells are merged I know it keeps throwing me an error saying cannot change contents of merged cells or something like that. Does anyone know how to get around this without unmerging the cells. I saw a code to unmerge all of the cells on a sheet but I really don't want to do this as I already have worked around most of my problems with the merged cells.
View 14 Replies
View Related
Aug 11, 2008
I am having the same problem as this thread Dynamic Ranges with blank cells.
I've recently been pointed in the direction of dynamic ranges (named ranges that use OFFSET and COUNTA to expand to cover the whole of a list, even if the number of rows used is frequently changed).
They seem to have a big drawback, in that the range will not go to the bottom of the list if the list has blank cells in (because the COUNTA for the column of interest does not equal the number of rows in the list).
A typical named range might look like this:
=OFFSET(Sheet1!$A$2,0,0,COUNTA(Sheet1!$A$2:$A$25),1)
I tried to post in it but it's too old.
I have been to the link posted in that thread about advanced dynamic named ranges but inserting a row with numbers in it and then hiding it is not suitable for me as i deal with other peoples spreadsheets so need to always be working with the Active Sheet.
View 4 Replies
View Related
Jan 25, 2010
I have written this code to clear the contents of certain cells, lock the content of others and protect the sheet again it works on sheet1 but not on sheet 7. This is suppose to happen when the Print button on my sheet is clicked.
View 4 Replies
View Related
Mar 30, 2008
how do i create a formula or macro that will: Clear the contents of Cell C1 If Both Cell A1 And B1 Are Filled. I will need to check all the cells in column A,B and C.
View 2 Replies
View Related
Dec 9, 2009
(1) I want to find the maximun number for the past n periods in a range of cells, but I want to be able to vary n by changing the number of periods in one cell at the top of the sheet, i.e. if i enter 10 in cell A1 the function will return the max number for 10 periods over a certein range, if I change the figure to 20, then the max number for 20 periods will be returned!
(2) I have a column (lets say column c) which will return a number of values if my criteria are met and 0 if not, I want a function in another column which will replace the 0 with the next non 0 figure in column c, the gaps between the non 0 figures can vary. I feel it involves looping in some form, and writing a new function, but I am not sure.
View 9 Replies
View Related
Jul 2, 2014
I have attached a test workbook excel 2010 (ignore ref# errors, I've cut the workbook down for uploading purposes) What I would like to do is have a 'Button' on my 'information Sheet' which when clicked would clear certain cells. I have searched the forum but can't find a solution, everyone seems to want to delete rows or columns but I just want to clear certain cells. The workbook will have 11 sheets each named 'caravan 1' through to 'caravan 11' The uploaded test workbook only only has 3 sheets.
On 'caravan 1' (which is slightly different to the other 10) I want to clear the content of cells
B4 & B5
C4, C22 & C41
D4 & D5
E4,E5, E22,E23,E41 &E 42
On all other 'Caravan sheets' I want to clear the contents of cells
D4 & D5
E4, E5, E22, E23, E41 & E42
It would be icing on the cake if it could give a warning such as " are you sure you want to clear these cells" but that isn't really necessary. The worksheets will be password protected, but the cells mentioned above will not be. If it proves too difficult to clear all the cells on all the sheets with one click, then perhaps a simpler solution might be to have a button on each sheet instead
View 8 Replies
View Related
Apr 16, 2009
I am getting a #VALUE! error in one of my cells. I know it is because my worksheet is missing information to complete the formula. The information will be inputted periodically in the worksheet (lets call it worksheet number one). But, I have the results of cells in worksheet one that are tied to worksheet number two. Worksheet number two is getting the #VALUE! also until worksheet number one is completed (periodically).
But, in worksheet number two, I have an auto sum that adds up the results from worksheet one so I am getting the same #VALUE! error on the auto sum because only a few worksheet from worksheet one are complete. Is there anyway to clear the #VALUE! and get a number in the auto sum even if only a few worksheets from worksheet number one are inputted?
View 4 Replies
View Related
Apr 25, 2002
I need to clear all cells in a column that have a particular value. The value is sometimes a constant like "0" (zero) and sometimes is a value based on a formula. Is there a VBA code that will allow me to select those cells in column matching a particular value and clear them?
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
Apr 16, 2014
I have a spreadsheet with a large table of data (values only no formulas). Whoever programmed it, they decided that cells with irrelevant entries should display three dots, i.e. "...". Problem is now need to clear these cells (so they are truly blank) but some of them have been auto-corrected in to ellipses and some have not. I wrote the following code:
[Code] .....
This is fine for the three dots that are just three dots, but for the ones that were auto-corrected to ellipses it doesn't work. How do I amend the code so that it clears the cells that are three dots and the ellipses too?
View 2 Replies
View Related
Jul 25, 2014
I have a button, and I need a Macro that will cause it to clear all unprotected cells. I think I can figure out how to get it to clear an individual cell, and I suppose I could enter every cell I want cleared individually...but that might take awhile.
Is there a way to set up a Macro that will delete the contents of every unprotected cell? I guess I haven't tried it yet - if I protect the cells, will it not delete those? Also, there is a small image - I don't want that deleted either.
View 8 Replies
View Related
Oct 8, 2012
I have a spreadsheet that has merged cells on that is typed into.
I have a Macro that pulls the information into another sheet and then it tries to clear the cells for the next person to fill in. The issue I am having is that i cant clear the merged cell. I have tried the following code
Code:
Sheets("Coach").Select
Cells(18, 2) = ""
Range(Cells(18, 2), Cells(26, 11)).ClearContents
Sheets("Coach").Cells(18, 2).ClearContents
View 5 Replies
View Related
Jul 6, 2008
The best script to clear all non-blank cells, in my case from Cells(7,1) forward. I currently use this:
.Range(Cells(7, Columns.Count), Cells(Rows.Count, 1)).Value = ""
Will this scipt take a lot of memory to execute? Is there any other method?
View 9 Replies
View Related
Jul 4, 2007
I have a spreadsheet wherein the defined data input cells are formatted using styles, i.e. data input style. I would like to know how to select all cells formatted with that style within a spreadsheet (whether worksheets are visible, hidden or very hidden) and delete the contents of those cells while still keeping the cell style.
View 9 Replies
View Related
Jul 23, 2007
Am looking for routine that can be used to delete the contents of cells from multiple, non-contiguous cells throughout a single worksheet. I would like to place a "button" or some form of toggle-switch on the worksheet that will clear all entries at once. I see a thread "Macro Deleting Wrong Cells" that references a VBA sub-routine called "DelCells". I happen to be running Excel 2007 and am still adjusting to the new menu "structure" :-)
View 5 Replies
View Related
Oct 10, 2007
Gotta question about destroying the contense of a worksheet. If for instance I got a macro which uses a different source everytime I run it, and this macro gives a result in a result worksheet. How can I possibly delete the contense of the result worksheet automatically before the execution starts? What I mean is: without selecting all the cells and pressing delete or either using a for loop to go through all the worksheet cells. Is there any function which clears the contense of a worksheet? (without deleting the worksheet itself)
View 2 Replies
View Related
Feb 22, 2008
I have the following code in a Excel 2003 spreadsheet with hope that I can clear contents of unlocked cells in one excel file from the code stored in another Excel file.
Sub CLEARSJCCOUNT()
'
' CLEARSJCCOUNT Macro
' Macro recorded 02/21/2008 by Steve Keene
'
Windows("copyAUTOCOUNTSHT.xls").Activate
I get the Subscript Out of Range error window when it hits the first line of code.
I've reviewed this via searching for other posts, but none seem to solve the problem directly.
View 3 Replies
View Related
Apr 24, 2008
How would I write an if statement that checks to see if the date entered is two weeks past?
View 9 Replies
View Related
Mar 10, 2014
In Column C, I have a variable range (usually like, C5:C100000) that has data validation in it. However, only about 10% of the cells have a value from that data validation list in them (which is what I want). I'd like to write a macro that only cleared out the cells with no value in them, so that they no longer had any data validation in them. Is this possible?
View 2 Replies
View Related