#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 19
Default Cells.Clear

Is there a way to change "Cells.Clear" so
that it only clears a certain section instead of the whole sheet? We used
abbreviations for our sheet names but would like to have the longer name next
to the abbreviated hyperlink for people new to the abreviations.

I have modified it so that the hyperlinks appera in Column B, starting in
cell 3, can we have it clear only column B from 3+ instead of the whole sheet?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Cells.Clear

Ben

I would just use a range.

ActiveSheet.Range("B3:B65536").Clear

Do you need this in a macro?

Might be just as eay to select B3 then SHIFT + End + DownArrow and
EditClearAll


Gord Dibben MS Excel MVP

On Wed, 24 Jan 2007 13:55:01 -0800, Ben Dummar
wrote:

Is there a way to change "Cells.Clear" so
that it only clears a certain section instead of the whole sheet? We used
abbreviations for our sheet names but would like to have the longer name next
to the abbreviated hyperlink for people new to the abreviations.

I have modified it so that the hyperlinks appera in Column B, starting in
cell 3, can we have it clear only column B from 3+ instead of the whole sheet?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 19
Default Cells.Clear

Yes,

I am trying to use it in the following macro code:

---
Private Sub Worksheet_Activate()
Dim anySheet As Worksheet
Dim myCounter As Long

Cells.Clear ' remove previous content
myCounter = 0
For Each anySheet In Worksheets
If anySheet.Name < ActiveSheet.Name Then
Range("B2").Offset(myCounter, 0) = anySheet.Name
'this adds hyperlink remove if you don't want it
ActiveSheet.Hyperlinks.Add anchor:=Range("B2").Offset(myCounter, 0), _
Address:="", SubAddress:="'" & anySheet.Name & "'!A1"
'update the offset counter, keep this
myCounter = myCounter + 1
End If
Next
End Sub
----

"Gord Dibben" wrote:

Ben

I would just use a range.

ActiveSheet.Range("B3:B65536").Clear

Do you need this in a macro?

Might be just as eay to select B3 then SHIFT + End + DownArrow and
EditClearAll


Gord Dibben MS Excel MVP

On Wed, 24 Jan 2007 13:55:01 -0800, Ben Dummar
wrote:

Is there a way to change "Cells.Clear" so
that it only clears a certain section instead of the whole sheet? We used
abbreviations for our sheet names but would like to have the longer name next
to the abbreviated hyperlink for people new to the abreviations.

I have modified it so that the hyperlinks appera in Column B, starting in
cell 3, can we have it clear only column B from 3+ instead of the whole sheet?



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Cells.Clear

See in-line below

Gord

On Wed, 24 Jan 2007 14:31:01 -0800, Ben Dummar
wrote:

Yes,

I am trying to use it in the following macro code:

---
Private Sub Worksheet_Activate()
Dim anySheet As Worksheet
Dim myCounter As Long

Delete this line Cells.Clear ' remove previous content
Add this line ActiveSheet.Range("B3:B65536").Clear

myCounter = 0
For Each anySheet In Worksheets
If anySheet.Name < ActiveSheet.Name Then
Range("B2").Offset(myCounter, 0) = anySheet.Name
'this adds hyperlink remove if you don't want it
ActiveSheet.Hyperlinks.Add anchor:=Range("B2").Offset(myCounter, 0), _
Address:="", SubAddress:="'" & anySheet.Name & "'!A1"
'update the offset counter, keep this
myCounter = myCounter + 1
End If
Next
End Sub
----

"Gord Dibben" wrote:

Ben

I would just use a range.

ActiveSheet.Range("B3:B65536").Clear

Do you need this in a macro?

Might be just as eay to select B3 then SHIFT + End + DownArrow and
EditClearAll


Gord Dibben MS Excel MVP

On Wed, 24 Jan 2007 13:55:01 -0800, Ben Dummar
wrote:

Is there a way to change "Cells.Clear" so
that it only clears a certain section instead of the whole sheet? We used
abbreviations for our sheet names but would like to have the longer name next
to the abbreviated hyperlink for people new to the abreviations.

I have modified it so that the hyperlinks appera in Column B, starting in
cell 3, can we have it clear only column B from 3+ instead of the whole sheet?




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



All times are GMT +1. The time now is 06:53 AM.

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

About Us

"It's about Microsoft Excel"