Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Clear Doesnt Work

I have a named cell in B2. I want to clear all the data starting for
C2 onward down the columns. The following works if my cursor is on th
worksheet of the named cell.

Range("NamedCell").Offset(0, 1).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.ClearContents

How can I mod this so that I do not have to be on the sheet itself?

Thank-yo

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Clear Doesnt Work

Try the following:

With Range("NamedCell")
Range(.Offset(0, 1), .Offset(0, 1).End(xlToRight)).Clear
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"ExcelMonkey " wrote
in message ...
I have a named cell in B2. I want to clear all the data

starting form
C2 onward down the columns. The following works if my cursor

is on the
worksheet of the named cell.

Range("NamedCell").Offset(0, 1).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.ClearContents

How can I mod this so that I do not have to be on the sheet

itself?

Thank-you


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Clear Doesnt Work

With Worksheets("Sheet1")
.Range(.Range("NamedCell").Offset(0, 1),
..Range("NamedCell").Offset(0, 1).End(xlToRight)).ClearContents
End With

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"ExcelMonkey " wrote in message
...
I have a named cell in B2. I want to clear all the data starting form
C2 onward down the columns. The following works if my cursor is on the
worksheet of the named cell.

Range("NamedCell").Offset(0, 1).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.ClearContents

How can I mod this so that I do not have to be on the sheet itself?

Thank-you


---
Message posted from http://www.ExcelForum.com/



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
Why doesnt this work? MurrayBarn Excel Worksheet Functions 2 November 19th 09 04:21 PM
Auto Sum doesnt work NAS Excel Discussion (Misc queries) 1 October 2nd 09 08:57 PM
Why doesnt this work steve New Users to Excel 1 March 3rd 08 04:52 PM
COUNTIF doesnt work! jjj Excel Worksheet Functions 2 September 30th 05 02:38 AM
sum totaling doesnt work Bedros Excel Worksheet Functions 1 July 6th 05 04:15 AM


All times are GMT +1. The time now is 09:07 PM.

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"