Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Sub to clear range above n below diagonal | Excel Programming | |||
If range is empty, clear other cells | Excel Programming | |||
Clear Contents of a Selected Range | Excel Programming | |||
Clear Contants in a Range Based on a Value | Excel Programming | |||
Clear range of cells in different worksheet | Excel Programming |