Clear Data Macro

Jul 5, 2009

I've reformatted the spreadsheet, and now some of the data are in merged cells.

The code lnow ooks like below, (Which I thought would work) but it doen't work ,,, and I'm not sure why


Sub Clear_Risk_Data()
If Range("J5:K5,D12,G11:H11,M11:O11") = Empty Then
MsgBox "No data to Clear."
Else
Range("J5:K5,D12,G11:H11,M11:O11").ClearContents
MsgBox "All Data Has Been Cleared", vbInformation
End If
End Sub

My sheet (An excel 2007 macro enabled version), I've just uploaded here, in case anyone needs to view it, I just don't know why it won't work?
[url]

There are just 4 boxes to clear,
Box 1,, is cell J5 & K5
Box2 is cell D 12
Box 3 are cells G11 & H11
& Box 4 are cells M11, N11 & O11

View 9 Replies


ADVERTISEMENT

Macro To Clear Row Data Then Shift Remaining Data Up To Empty Rows?

Apr 15, 2014

I'd like to have a sheet with multiple columns of data (say A thru K for instance.). Id like to reserve column A for ONLY imputing an X. The rest of the columns b-K would have data in the cells. I'd like to have a macro that when it saw an X in column A, would copy all of the data in cells B-K in that row, paste it into the next empty row of a second sheet (for history tracking), then go back to the original sheet and continue looking for additional "X"'s and repeat. Once all of the X's were copied, it would "clear" (Not delete because some of the cells would have formulas in them that would need to remain for future use.) the cells based on the "X" then finally move all of the remaining data up to the empty rows to fill in the empty rows. This last piece would be more for esthetics to have a clean looking sheet.

View 1 Replies View Related

Macro To Clear Data

Jan 5, 2010

I have a spreadsheet that I enter data for cash flow purposes on a daily basis. At the beginning of each month I need to clear out the data containing values only as well as values beginnining with an = for eg 20000+50000+25000+74000 etc, but not formulas and text

I need the macro to clear the values , including data that has been added up as explaimned above from row 9 onwards and from column C

View 9 Replies View Related

Macro - Enter Data In Next Clear Row After Every Run

Jun 27, 2014

I have a macro that

- copies rows from one sheet into another sheet based on a set of criteria
- the very very very first time the macro is run, the first row of data should be put into row 7 (formatting reasons)
- however, every other time it's run it should paste into the next clear row.

But, what is happening is that, each time its run, it puts the data into row 7 => overwriting data.

I've used the offset and counter function but perhaps I need to put it in the header of the code to get it working?

My code pasted below:

[Code] .....

View 4 Replies View Related

Mutiple Clear Data Macro

May 16, 2009

I have made a spreadsheet but would love to be able to incorporate multiple 'Clear Data Buttons', (Macros)
that clear cell data.

I have attached several screen shots of my spreadsheet, with the URLs listed below.
(Images 1-6)
http://tinyurl.com/qba57l
http://tinyurl.com/od9upb
http://tinyurl.com/ovaeej
http://tinyurl.com/pctsvj
http://tinyurl.com/oc2qqm
http://tinyurl.com/qdhzge
Spreadsheet (xls & xlsm) in zip format
http://tinyurl.com/qczlap

It is a trading order sheet that I want to use, but also upload to a blog that I have just
started, relating to trading as a free download, hopefully it may benefit some users/visitors etc.

OK, regarding the macros.

I'm not quite sure how it is best to do it.
In total there are 13 'Clear Buttons.'

11 are 'CLEAR DATA' Buttons
12 is a 'Clear ONLY ORDER SHEET DATA' Button.
Finally 13 is a 'Clear All DATA!' Button

I think it's best if I give the cell location of where I would like the macro buttons located and what data they clear.
Clear DATA - Button 1 - (Is in Cell F3) - To Clear Data, Columns D,E,F & Rows 4 to 13)
Clear DATA - Button 2 - (Is in Cell N3) - To Clear Data, Columns G to O & Rows 4 to 13)
Clear DATA - Button 3 - (Is in Cell U3) - To Clear Data, Columns S,T & U & Rows 4 to 13)
Clear DATA - Button 4 - (Is in Cell F15) - To Clear Data, Columns D,E,F & Rows 16 to 25)
Clear DATA - Button 5 - (Is in Cell N15) - To Clear Data, Columns G To O & Rows 16 to 25)
Clear DATA - Button 6 - (Is in Cell U15) - To Clear Data, Columns S,T & U & Rows 16 to 25)................................

View 8 Replies View Related

Clear Data Not Format With Macro

Nov 7, 2009

I have a worksheet (“A”) that is populated from a second sheet (“B”). The data on “A” changes as necessary using another Macro. Most of the data on sheet “B” is numeric and comes from various formulas and results in numbers with too may digits after the decimal point. I can format sheet “A” to turn 58.22222222 into 58.2 but when I run a Macro to clear the data I lose the formatting. I need to find a way to clear only the data and not the format, or find a way to add a mask on specific columns in the macro that copies and pastes. Here is the Macro to clear the data.

View 3 Replies View Related

Macro To Clear Some Data Within A Cell But Leave Other Data

Dec 24, 2009

What i want to do is clear some data within a merged cell but leave the rest.

I have added a sample workbook. The data i want to clear is highlighted in Red so the 11111 will be replaced with ...... and the 09/12/09 will also be replaced with .......

View 7 Replies View Related

Macro To Clear Data In Specific Columns

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

Clear List Macro For Data Validation - Multiple Lines In Table

Aug 1, 2014

I have a spreadsheet where I am tracking several entries in a table that will keep growing. Three fields are Data Validation Drop Down Lists. The macro below works well to clear the two lists to the right when the first one is changed by the user.

[Code] .....

I want this to affect the rows below it in the table as they are added.

View 2 Replies View Related

Clear Macro NOT Clear Formula?

Aug 15, 2014

I'm having a problem with a macro clearing a formula in a cell. I have the same type of cell that doesn't have the problem but I can't find the difference between the 2 cells or difference in vb that's making it happen. I have to intentionally cause this to happen but don't see why it's happening. Do I need to attach workbook and describe what's happening? I have been copying and pasting from different sources as well as paying to have it created/started but it was expensive(for me) and I make nothing off of it, just use it at work. I am not proficient in Excel or vb but I'm desperately trying to learn as I go so as not to fork out a few hundred dollars again.

here's atleast the vb for the macros:

VB:
Sub clearclientinfo() '
'
'
'
Sheet5.Select

[Code].....

View 9 Replies View Related

Add Clear Content To Macro?

Dec 4, 2012

i have the following macro when cell value in column "K" changes, it distributes the data accordingly.

however, the issue is, if i change the value in K (which is a date), so another value, it leaves the distribution in tact....i want to apply "clear content" and then make the macro re-apply.

Code:

Private Sub Worksheet_Change(ByVal Target As Range)
If Left(Target.Address, 3) = "$K$" Then
Dim srt As String

[Code].....

View 9 Replies View Related

Macro To Clear Cells

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

Macro To Clear Contents.

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

Clear Cells To Right IF Macro

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

Macro For Min Value Then Clear Contents

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

Clear Contents Macro

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

Macro To Clear Zero's In Columns

Jul 21, 2007

I need a macro that will clear out all zero's in columns D8:O?

The amount of rows vary, but should never exceed 1000. I'am not wanting any cells to shift. Just the contents deleted.

In other words, if e5 contains the value 0, I need it to not contain anything.

The exception is the total row.see file for example.

View 7 Replies View Related

Clear Data Depending On User Input And Move Cells Forward Without Deleting Data Table

Oct 25, 2012

I have an month input in cells B2 (user can enter values from 1-5)

I then have a data table that has month 1,2,3,4,5 running across range G9:K9. the data is held in range G10:K19.

So if user types in 4 in B2, what should happen is that months 1,2,3 and 4 the data for these months should be cleared and data in month 5 moves forward into month 1.

So basically, anything left of the month entered is B2 should be cleared and replaced with anything right of the month in B2.

1
2
3
4
5

£11
£133
£29
£193
£100

[Code] ........

View 3 Replies View Related

Keep Macro From Clear Entire Sheet

Feb 25, 2014

This macro clears all the contents of each sheet to which it refers, however, after putting it to use I find that I need it to clear only columns A-G starting at row 10. I am not sure how to modify it to do so though. Actually it would be even better if it would only clear columns A, B, C, E, F, and G.

View 14 Replies View Related

Cell Protection & Clear Macro

Oct 14, 2008

when i password protect my sheet it doesnt let my clear cells macro work on the cells i need it to clear why is this and what way is there around this completes my complex sheet.

View 2 Replies View Related

Macro Button To Clear Certain Cells

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

Macro To Clear Colums In Range

Jun 19, 2009

I am trying to create a marco that clears the columns of a named range if the sum of the cells in the range is zero.

View 3 Replies View Related

Macro To Clear All Contents Of Spreadsheet?

Nov 16, 2011

macro code to clear a spread sheet of all of its content? (The extent of the content can vary.)

View 2 Replies View Related

Macro To Clear Contents Of Workbook

Dec 8, 2011

I have a workbook that I re-use on a weekly basis. The header information must stay intact (Rows 1 and 2). I recorded a macro that would clear all tabs in the workbook, and that macro is:

Code:
Sheets("Sheet1").Select
Rows("3:1865").Select
Selection.Delete Shift:=xlUp
Range("A3").Select
Sheets("Sheet2").Select
Rows("3:1865").Select
Selection.Delete Shift:=xlUp
Range("A3").Select

Which made me curious if there was a VBA code to say "Clear Worksheet" as opposed to having to explicitly list the cells that need to be cleared?

View 6 Replies View Related

Macro Code To Copy And Clear

Jan 2, 2012

I need multiple macros to copy information from sheet1 to sheet2 and another to copy the information from sheet1 to sheet3 and so on. need a total of 20 macros each to copy information from sheet1 and paste it to the corresponding sheet number. How to do it and this this is what i want to do, Copy roll A-B-C-D,and G but not E-F-H i have formulas that i don't want to clear or re-do every time it is possible to do this.

a B C D E F G H
HarvestDate VarietyL/P Code Label Pakagin Qty Total
1 12/2/2012 Soda 23 3
1 12/12/2012 plants 24 34
1 12/13/2012 socks 25 22
1 12/14/2012 shoes 26 22
1 12/15/2012 tie 27 22
1 12/16/2012 cds 28 22
1 12/17/2012 computer 29 22
1 12/18/2012 tapes 30 22

View 8 Replies View Related

Macro Insert And Clear Contents

Nov 2, 2007

I am trying to get a macro that will insert a line above whatever line the text "INSERTXYZ" is in. I'm getting that fine but I also want to clear the contents of cells "A:S" on whatever the new row number is.

Can anyone modify this piece to accomplish that? If you need to tear it completely down, I'm interested in simpler way as well.

Cells.Find(What:="INSERTXYZ", After:=ActiveCell).Select
ActiveCell.EntireRow.Select
Selection.EntireRow.Copy
Selection.EntireRow.Insert Shift:=xlDown
Selection.Interior.ColorIndex = xlNone
Application.CutCopyMode = False
ActiveCell.Select
Selection.Range("A:S").ClearContents

View 9 Replies View Related

Macro To Clear Rows On Another Sheet

Aug 12, 2008

I have a macro that copies data into another sheet (OR) from sheet1 (EDS) but as I don't want the data added from the last row I want it to overwrite and clear any data that was there before. However I still want to keep my headings which occupy rows 1 and 2.

This is the code I was using...

Sheets("OR").Select
Rows("2:30").Select
Selection.ClearContents
Sheets("EDS").Select

This is pretty inefficent but it works. I don't want to make a new macro I like keeping it inserted in my current one. However I couldn't figure out how to get it to delete the rows past row 2 (it could go to infinity but I don't think there will ever be more than 30 rows of data).

View 7 Replies View Related

Clear Old Data And Add New Data Every Month, The Named Range Changes

Dec 13, 2008

I have 30 worksheets in a workbook in which the first sheet is called summary. The summary sheet has 29 formulas with all named ranges, so one named ranged per worksheet. The issue I have is when i clear old data and add new data every month, the named range changes on some worksheets not pointing to the correct range as previous month file even if I have $

View 9 Replies View Related

Macro To Clear Range In Specific Sheets

Apr 27, 2014

Looking to code a loop to go to sheets whose names begin with "day" and a number and clear a specific range. How would i code this without affecting the other sheets in the book?

View 3 Replies View Related

Modification Of Macro To Clear Not Delete Page

Feb 26, 2009

I have a macro that I found on the net for copying a filtered selection and copying to a new sheet. I would like to alter it slightly so that it just clears the sheet called 'Interval tasks' instead of deleting it and creating a new one.

View 8 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved