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
|
|
0
|
|
|
|
Reply
|
Michael
|
4/25/2010 3:08:48 PM |
|
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" <michaelrlanier@gmail.com> wrote in message
news:05322cef-827a-4f7d-820e-31734d481b0b@x3g2000yqd.googlegroups.com...
>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
|
|
0
|
|
|
|
Reply
|
JLGWhiz
|
4/25/2010 3:28:01 PM
|
|
Thanks so much for your help. I'll try it out when I get back on the
program tomorrow.
Michael
|
|
0
|
|
|
|
Reply
|
Michael
|
4/25/2010 5:51:55 PM
|
|