#1   Report Post  
Old December 7th 08, 09:54 PM posted to microsoft.public.excel.worksheet.functions
DDD DDD is offline
external usenet poster
 
First recorded activity by ExcelBanter: Oct 2006
Posts: 24
Default Record deletion

I have 2 questions

1)
Is there any way to link a macro & cell together.
For example, i have a cell that has a kind of count down in days, updated
every day (open the spreadsheet today & its 10, open it the next day & its 9)
when the number within the cell reaches 0, it activates a macro that deletes
the entire row THAT the cell (that has 0 in it) is include within.

2)i have formulae from I5-I35 & K5-K35, is there any way, i cant stop these
getting deleted (From the method used above).

The result i want to get, is that i want a row to be selected & deleted
except the cells that have a formula in them. Then all the cells under this
move up 1 row (The formulae never move)


Sorry if this is hard to understand

  #2   Report Post  
Old December 8th 08, 02:05 PM posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
First recorded activity by ExcelBanter: Jul 2007
Posts: 2,276
Default Record deletion

Hi DDD,
If the cell you won't to delete is in A1 you can add to your macro something
like this
Sub Macro1()
'
' Macro1 Macro
'

Dim myrange, MyRange1 As Range
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
Set myrange = Sheets("Sheet1").Range("A10:F" & lastRow)
If Range("A1") = 0 Then

myrange.Delete
End If
End Sub
Change F to the last column you want to delete

"DDD" wrote:

I have 2 questions

1)
Is there any way to link a macro & cell together.
For example, i have a cell that has a kind of count down in days, updated
every day (open the spreadsheet today & its 10, open it the next day & its 9)
when the number within the cell reaches 0, it activates a macro that deletes
the entire row THAT the cell (that has 0 in it) is include within.

2)i have formulae from I5-I35 & K5-K35, is there any way, i cant stop these
getting deleted (From the method used above).

The result i want to get, is that i want a row to be selected & deleted
except the cells that have a formula in them. Then all the cells under this
move up 1 row (The formulae never move)


Sorry if this is hard to understand



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
name deletion rk0909 Excel Discussion (Misc queries) 2 January 4th 08 11:03 PM
simple row deletion lawson Excel Discussion (Misc queries) 3 October 17th 07 06:57 PM
Accidental Deletion Brian Frantz Setting up and Configuration of Excel 2 August 25th 06 08:51 AM
On deletion of rows Stephen Howe Excel Discussion (Misc queries) 2 October 7th 05 06:02 PM
Sheet deletion mitch Excel Discussion (Misc queries) 4 August 19th 05 12:10 AM


All times are GMT +1. The time now is 06:21 PM.

Powered by vBulletin® Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.
Copyright 2004-2021 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"

 

Copyright © 2017