PC Review


Reply
Thread Tools Rate Thread

Delete contents of cells in a range based on value of a cell

 
 
Michael Lanier
Guest
Posts: n/a
 
      25th Apr 2010
I want to be able to delete the contents of a range of cells
(A100:K200) based on the values I manually enter into cells A1 and B1,
everything to run in Sheet1. A1's entry is the first row of the range
to delete (A100:K100) and B1's entry is the last row of the range
(A200:K200). Can someone provide a fairly simple macro for this?
Thanks in advance.

Michael
 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      25th Apr 2010
To deleted entire rows, assuming by your example that A1 would be 100 and B1
would be 200.

Sub dele()
Dim x As Long, y As Long
x = Range("A1").Value
y = Range("B1").Value
Rows(x & ":" & y).Delete
End Sub

However, if you only want to clear contents of columns A - K of those rows
and A1 is A100 and B1 is K200, then:

Sub dele2()
Dim x As String, y As String
x = Range("A1").Value
y = Range("B1").Value
Range(x & ":" & y).ClearContents
End Sub


"Michael Lanier" <(E-Mail Removed)> wrote in message
news:05322cef-827a-4f7d-820e-(E-Mail Removed)...
>I want to be able to delete the contents of a range of cells
> (A100:K200) based on the values I manually enter into cells A1 and B1,
> everything to run in Sheet1. A1's entry is the first row of the range
> to delete (A100:K100) and B1's entry is the last row of the range
> (A200:K200). Can someone provide a fairly simple macro for this?
> Thanks in advance.
>
> Michael



 
Reply With Quote
 
Michael Lanier
Guest
Posts: n/a
 
      25th Apr 2010
Thanks so much for your help. I'll try it out when I get back on the
program tomorrow.

Michael
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete Range of cells and move left based on Cell value Thomp Microsoft Excel Discussion 3 10th Mar 2010 08:02 PM
range inside RANK formula based on contents of other cells =?Utf-8?B?YW5keTYy?= Microsoft Excel Worksheet Functions 3 5th Sep 2006 07:37 PM
Delete/clear a cell based on another cells contents =?Utf-8?B?amFkZW1hZGR5?= Microsoft Excel Programming 3 19th May 2005 06:15 PM
How do I select a whole range and delete the contents of the cells? =?Utf-8?B?YmVudGhvbWFzX2R1Y2s=?= Microsoft Excel Programming 2 4th Jun 2004 02:31 AM
Getting the average of the contents of a range of cells based on a condition mahoobley Microsoft Excel Misc 3 21st May 2004 03:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:20 PM.