#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Clear Range

Below is a sample of my worksheet. I'd like to clear the range B1:C3, which
should be the active range minus the Row 1 headers. How can I delete or
clear just the values and not the first row's headers?

LISTING 1:

HeaderA HeaderB HeaderC
20
5 150 75
50


LISTING 2:

HeaderA HeaderB HeaderC



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Clear Range

Range("B2:C3").Clear

Note that using Range("B1:C3") would clear that top row as well.
--
Gary''s Student - gsnu2007b


"scott" wrote:

Below is a sample of my worksheet. I'd like to clear the range B1:C3, which
should be the active range minus the Row 1 headers. How can I delete or
clear just the values and not the first row's headers?

LISTING 1:

HeaderA HeaderB HeaderC
20
5 150 75
50


LISTING 2:

HeaderA HeaderB HeaderC




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Clear Range

The problem is that the active range will always be changing, so I need the
target range to basically be the active range minus row 1.


"Gary''s Student" wrote in message
...
Range("B2:C3").Clear

Note that using Range("B1:C3") would clear that top row as well.
--
Gary''s Student - gsnu2007b


"scott" wrote:

Below is a sample of my worksheet. I'd like to clear the range B1:C3,
which
should be the active range minus the Row 1 headers. How can I delete or
clear just the values and not the first row's headers?

LISTING 1:

HeaderA HeaderB HeaderC
20
5 150 75
50


LISTING 2:

HeaderA HeaderB HeaderC






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 367
Default Clear Range

If your data starts in A2 you could do following:

Sub delete_rows()

Dim range_str As String
range_str = UsedRange.Address

If UsedRange.Rows.Count 1 Then
Range("$A$2:" & Right(range_str, _
Len(range_str) - InStr(1, _
range_str, ":"))).Delete
End If

End Sub

hth

Carlo

On Dec 20, 11:36 am, "scott" wrote:
The problem is that the active range will always be changing, so I need the
target range to basically be the active range minus row 1.

"Gary''s Student" wrote in message

...



Range("B2:C3").Clear


Note that using Range("B1:C3") would clear that top row as well.
--
Gary''s Student - gsnu2007b


"scott" wrote:


Below is a sample of my worksheet. I'd like to clear the range B1:C3,
which
should be the active range minus the Row 1 headers. How can I delete or
clear just the values and not the first row's headers?


LISTING 1:


HeaderA HeaderB HeaderC
20
5 150 75
50


LISTING 2:


HeaderA HeaderB HeaderC- Hide quoted text -


- Show quoted text -


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
Sub to clear range above n below diagonal Max Excel Programming 8 September 27th 07 06:48 AM
If range is empty, clear other cells Shelly Excel Programming 2 March 28th 07 01:11 AM
Clear Contents of a Selected Range Connie Excel Programming 1 October 11th 06 09:20 AM
Clear Contants in a Range Based on a Value Jeff[_50_] Excel Programming 4 April 14th 06 12:58 AM
Clear range of cells in different worksheet Tim Kelley Excel Programming 1 December 30th 04 06:54 PM


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

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

About Us

"It's about Microsoft Excel"