PC Review


Reply
Thread Tools Rate Thread

clear data and named cell

 
 
greg
Guest
Posts: n/a
 
      19th Apr 2008
I know this code below will clear the text in a row.
But it will not clear out the named cells.
Is there a way to clear both?


Rows(CStr(iCurrentMergeStart & ":" & iCurrentMergeStart)).ClearContents


 
Reply With Quote
 
 
 
 
FSt1
Guest
Posts: n/a
 
      19th Apr 2008
hi
is iCurrentMergeStart the name? if so then....
ActiveWorkbook.Names("iCurrentMergeStart").Delete

regards
FSt1

"greg" wrote:

> I know this code below will clear the text in a row.
> But it will not clear out the named cells.
> Is there a way to clear both?
>
>
> Rows(CStr(iCurrentMergeStart & ":" & iCurrentMergeStart)).ClearContents
>
>
>

 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      19th Apr 2008
If you are right and iCurrentMergeStart is the name given to a named range,
then I would think (based on how the OP phrased his message) that he would
be looking for this...

Range("iCurrentMergeStart").ClearContents

or, if iCurrentMergeStart is a variable containing the name, then this...

Range(iCurrentMergeStart).ClearContents

rather than a method to physically delete the name from the Names
collection. But then again, you might be right as the question was not very
clearly stated to me.

Rick


"FSt1" <(E-Mail Removed)> wrote in message
news:CD20FF20-FEB2-4592-B0B6-(E-Mail Removed)...
> hi
> is iCurrentMergeStart the name? if so then....
> ActiveWorkbook.Names("iCurrentMergeStart").Delete
>
> regards
> FSt1
>
> "greg" wrote:
>
>> I know this code below will clear the text in a row.
>> But it will not clear out the named cells.
>> Is there a way to clear both?
>>
>>
>> Rows(CStr(iCurrentMergeStart & ":" & iCurrentMergeStart)).ClearContents
>>
>>
>>


 
Reply With Quote
 
FSt1
Guest
Posts: n/a
 
      19th Apr 2008
hi
you may be right. but from his title "clear data AND Named cell", i assumed
that was what it wanted. he is already clearing the data. and i did ask. is
that the name? question not clearly stated

Regards
FSt1

"Rick Rothstein (MVP - VB)" wrote:

> If you are right and iCurrentMergeStart is the name given to a named range,
> then I would think (based on how the OP phrased his message) that he would
> be looking for this...
>
> Range("iCurrentMergeStart").ClearContents
>
> or, if iCurrentMergeStart is a variable containing the name, then this...
>
> Range(iCurrentMergeStart).ClearContents
>
> rather than a method to physically delete the name from the Names
> collection. But then again, you might be right as the question was not very
> clearly stated to me.
>
> Rick
>
>
> "FSt1" <(E-Mail Removed)> wrote in message
> news:CD20FF20-FEB2-4592-B0B6-(E-Mail Removed)...
> > hi
> > is iCurrentMergeStart the name? if so then....
> > ActiveWorkbook.Names("iCurrentMergeStart").Delete
> >
> > regards
> > FSt1
> >
> > "greg" wrote:
> >
> >> I know this code below will clear the text in a row.
> >> But it will not clear out the named cells.
> >> Is there a way to clear both?
> >>
> >>
> >> Rows(CStr(iCurrentMergeStart & ":" & iCurrentMergeStart)).ClearContents
> >>
> >>
> >>

>
>

 
Reply With Quote
 
greg
Guest
Posts: n/a
 
      19th Apr 2008
Hello,
Thanks for the help.

Yes, clear the data and named cell.
I really don't want to delete the row. But clear the data. and also remove
all the named cells.


"FSt1" <(E-Mail Removed)> wrote in message
news:14B4D330-3B34-40B8-9920-(E-Mail Removed)...
> hi
> you may be right. but from his title "clear data AND Named cell", i
> assumed
> that was what it wanted. he is already clearing the data. and i did ask.
> is
> that the name? question not clearly stated
>
> Regards
> FSt1
>
> "Rick Rothstein (MVP - VB)" wrote:
>
>> If you are right and iCurrentMergeStart is the name given to a named
>> range,
>> then I would think (based on how the OP phrased his message) that he
>> would
>> be looking for this...
>>
>> Range("iCurrentMergeStart").ClearContents
>>
>> or, if iCurrentMergeStart is a variable containing the name, then this...
>>
>> Range(iCurrentMergeStart).ClearContents
>>
>> rather than a method to physically delete the name from the Names
>> collection. But then again, you might be right as the question was not
>> very
>> clearly stated to me.
>>
>> Rick
>>
>>
>> "FSt1" <(E-Mail Removed)> wrote in message
>> news:CD20FF20-FEB2-4592-B0B6-(E-Mail Removed)...
>> > hi
>> > is iCurrentMergeStart the name? if so then....
>> > ActiveWorkbook.Names("iCurrentMergeStart").Delete
>> >
>> > regards
>> > FSt1
>> >
>> > "greg" wrote:
>> >
>> >> I know this code below will clear the text in a row.
>> >> But it will not clear out the named cells.
>> >> Is there a way to clear both?
>> >>
>> >>
>> >> Rows(CStr(iCurrentMergeStart & ":" &
>> >> iCurrentMergeStart)).ClearContents
>> >>
>> >>
>> >>

>>
>>



 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      19th Apr 2008
Remove "all" the named cells on a single worksheet (the one whose row you
cleared) or throughout your entire workbook?

Rick


"greg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
> Thanks for the help.
>
> Yes, clear the data and named cell.
> I really don't want to delete the row. But clear the data. and also
> remove all the named cells.
>
>
> "FSt1" <(E-Mail Removed)> wrote in message
> news:14B4D330-3B34-40B8-9920-(E-Mail Removed)...
>> hi
>> you may be right. but from his title "clear data AND Named cell", i
>> assumed
>> that was what it wanted. he is already clearing the data. and i did ask.
>> is
>> that the name? question not clearly stated
>>
>> Regards
>> FSt1
>>
>> "Rick Rothstein (MVP - VB)" wrote:
>>
>>> If you are right and iCurrentMergeStart is the name given to a named
>>> range,
>>> then I would think (based on how the OP phrased his message) that he
>>> would
>>> be looking for this...
>>>
>>> Range("iCurrentMergeStart").ClearContents
>>>
>>> or, if iCurrentMergeStart is a variable containing the name, then
>>> this...
>>>
>>> Range(iCurrentMergeStart).ClearContents
>>>
>>> rather than a method to physically delete the name from the Names
>>> collection. But then again, you might be right as the question was not
>>> very
>>> clearly stated to me.
>>>
>>> Rick
>>>
>>>
>>> "FSt1" <(E-Mail Removed)> wrote in message
>>> news:CD20FF20-FEB2-4592-B0B6-(E-Mail Removed)...
>>> > hi
>>> > is iCurrentMergeStart the name? if so then....
>>> > ActiveWorkbook.Names("iCurrentMergeStart").Delete
>>> >
>>> > regards
>>> > FSt1
>>> >
>>> > "greg" wrote:
>>> >
>>> >> I know this code below will clear the text in a row.
>>> >> But it will not clear out the named cells.
>>> >> Is there a way to clear both?
>>> >>
>>> >>
>>> >> Rows(CStr(iCurrentMergeStart & ":" &
>>> >> iCurrentMergeStart)).ClearContents
>>> >>
>>> >>
>>> >>
>>>
>>>

>
>


 
Reply With Quote
 
greg
Guest
Posts: n/a
 
      19th Apr 2008
just one row.
so
Rows(CStr("5:5")).ClearContents

"Rick Rothstein (MVP - VB)" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
> Remove "all" the named cells on a single worksheet (the one whose row you
> cleared) or throughout your entire workbook?
>
> Rick
>
>
> "greg" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hello,
>> Thanks for the help.
>>
>> Yes, clear the data and named cell.
>> I really don't want to delete the row. But clear the data. and also
>> remove all the named cells.
>>
>>
>> "FSt1" <(E-Mail Removed)> wrote in message
>> news:14B4D330-3B34-40B8-9920-(E-Mail Removed)...
>>> hi
>>> you may be right. but from his title "clear data AND Named cell", i
>>> assumed
>>> that was what it wanted. he is already clearing the data. and i did ask.
>>> is
>>> that the name? question not clearly stated
>>>
>>> Regards
>>> FSt1
>>>
>>> "Rick Rothstein (MVP - VB)" wrote:
>>>
>>>> If you are right and iCurrentMergeStart is the name given to a named
>>>> range,
>>>> then I would think (based on how the OP phrased his message) that he
>>>> would
>>>> be looking for this...
>>>>
>>>> Range("iCurrentMergeStart").ClearContents
>>>>
>>>> or, if iCurrentMergeStart is a variable containing the name, then
>>>> this...
>>>>
>>>> Range(iCurrentMergeStart).ClearContents
>>>>
>>>> rather than a method to physically delete the name from the Names
>>>> collection. But then again, you might be right as the question was not
>>>> very
>>>> clearly stated to me.
>>>>
>>>> Rick
>>>>
>>>>
>>>> "FSt1" <(E-Mail Removed)> wrote in message
>>>> news:CD20FF20-FEB2-4592-B0B6-(E-Mail Removed)...
>>>> > hi
>>>> > is iCurrentMergeStart the name? if so then....
>>>> > ActiveWorkbook.Names("iCurrentMergeStart").Delete
>>>> >
>>>> > regards
>>>> > FSt1
>>>> >
>>>> > "greg" wrote:
>>>> >
>>>> >> I know this code below will clear the text in a row.
>>>> >> But it will not clear out the named cells.
>>>> >> Is there a way to clear both?
>>>> >>
>>>> >>
>>>> >> Rows(CStr(iCurrentMergeStart & ":" &
>>>> >> iCurrentMergeStart)).ClearContents
>>>> >>
>>>> >>
>>>> >>
>>>>
>>>>

>>
>>

>



 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      19th Apr 2008
I think I am confused at what you want. Excel has a feature whereby you can
give a range (one or more cells) a Name and then use that name to refer to
the range rather than using the range's address. When I just asked you about
removing "named cells", you responded with this example...

Rows(CStr("5:5")).ClearContents

which isn't using a named range at all. That leads me to think you are using
the term "named cell" for something other than Excel's named ranges
(remember, that range can be a single cell which would make it a named
cell). Is that the case? If so, can you explain what you mean when you say
"named cell"... exactly what are you referring to when you say that?

Rick


"greg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> just one row.
> so
> Rows(CStr("5:5")).ClearContents
>
> "Rick Rothstein (MVP - VB)" <(E-Mail Removed)> wrote in
> message news:(E-Mail Removed)...
>> Remove "all" the named cells on a single worksheet (the one whose row you
>> cleared) or throughout your entire workbook?
>>
>> Rick
>>
>>
>> "greg" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Hello,
>>> Thanks for the help.
>>>
>>> Yes, clear the data and named cell.
>>> I really don't want to delete the row. But clear the data. and also
>>> remove all the named cells.
>>>
>>>
>>> "FSt1" <(E-Mail Removed)> wrote in message
>>> news:14B4D330-3B34-40B8-9920-(E-Mail Removed)...
>>>> hi
>>>> you may be right. but from his title "clear data AND Named cell", i
>>>> assumed
>>>> that was what it wanted. he is already clearing the data. and i did
>>>> ask. is
>>>> that the name? question not clearly stated
>>>>
>>>> Regards
>>>> FSt1
>>>>
>>>> "Rick Rothstein (MVP - VB)" wrote:
>>>>
>>>>> If you are right and iCurrentMergeStart is the name given to a named
>>>>> range,
>>>>> then I would think (based on how the OP phrased his message) that he
>>>>> would
>>>>> be looking for this...
>>>>>
>>>>> Range("iCurrentMergeStart").ClearContents
>>>>>
>>>>> or, if iCurrentMergeStart is a variable containing the name, then
>>>>> this...
>>>>>
>>>>> Range(iCurrentMergeStart).ClearContents
>>>>>
>>>>> rather than a method to physically delete the name from the Names
>>>>> collection. But then again, you might be right as the question was not
>>>>> very
>>>>> clearly stated to me.
>>>>>
>>>>> Rick
>>>>>
>>>>>
>>>>> "FSt1" <(E-Mail Removed)> wrote in message
>>>>> news:CD20FF20-FEB2-4592-B0B6-(E-Mail Removed)...
>>>>> > hi
>>>>> > is iCurrentMergeStart the name? if so then....
>>>>> > ActiveWorkbook.Names("iCurrentMergeStart").Delete
>>>>> >
>>>>> > regards
>>>>> > FSt1
>>>>> >
>>>>> > "greg" wrote:
>>>>> >
>>>>> >> I know this code below will clear the text in a row.
>>>>> >> But it will not clear out the named cells.
>>>>> >> Is there a way to clear both?
>>>>> >>
>>>>> >>
>>>>> >> Rows(CStr(iCurrentMergeStart & ":" &
>>>>> >> iCurrentMergeStart)).ClearContents
>>>>> >>
>>>>> >>
>>>>> >>
>>>>>
>>>>>
>>>
>>>

>>

>
>


 
Reply With Quote
 
greg
Guest
Posts: n/a
 
      19th Apr 2008
yes, maybe I am being confusing.

I think of a named cell as you can give a cell a specific name. such as C5.
and that is MySpecialC5. or something like that. where you can do a
Range("MySpecialC5")

So I have a row of text and cells that have been "named".
the Rows(CStr("5:5")).ClearContents
can remove the text in row 5. but the named cells are still there.
is there a way to remove both text and the named cells?
thanks for all the help


"Rick Rothstein (MVP - VB)" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
>I think I am confused at what you want. Excel has a feature whereby you can
>give a range (one or more cells) a Name and then use that name to refer to
>the range rather than using the range's address. When I just asked you
>about removing "named cells", you responded with this example...
>
> >

> which isn't using a named range at all. That leads me to think you are
> using the term "named cell" for something other than Excel's named ranges
> (remember, that range can be a single cell which would make it a named
> cell). Is that the case? If so, can you explain what you mean when you say
> "named cell"... exactly what are you referring to when you say that?
>
> Rick
>
>
> "greg" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> just one row.
>> so
>> Rows(CStr("5:5")).ClearContents
>>
>> "Rick Rothstein (MVP - VB)" <(E-Mail Removed)> wrote
>> in message news:(E-Mail Removed)...
>>> Remove "all" the named cells on a single worksheet (the one whose row
>>> you cleared) or throughout your entire workbook?
>>>
>>> Rick
>>>
>>>
>>> "greg" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Hello,
>>>> Thanks for the help.
>>>>
>>>> Yes, clear the data and named cell.
>>>> I really don't want to delete the row. But clear the data. and also
>>>> remove all the named cells.
>>>>
>>>>
>>>> "FSt1" <(E-Mail Removed)> wrote in message
>>>> news:14B4D330-3B34-40B8-9920-(E-Mail Removed)...
>>>>> hi
>>>>> you may be right. but from his title "clear data AND Named cell", i
>>>>> assumed
>>>>> that was what it wanted. he is already clearing the data. and i did
>>>>> ask. is
>>>>> that the name? question not clearly stated
>>>>>
>>>>> Regards
>>>>> FSt1
>>>>>
>>>>> "Rick Rothstein (MVP - VB)" wrote:
>>>>>
>>>>>> If you are right and iCurrentMergeStart is the name given to a named
>>>>>> range,
>>>>>> then I would think (based on how the OP phrased his message) that he
>>>>>> would
>>>>>> be looking for this...
>>>>>>
>>>>>> Range("iCurrentMergeStart").ClearContents
>>>>>>
>>>>>> or, if iCurrentMergeStart is a variable containing the name, then
>>>>>> this...
>>>>>>
>>>>>> Range(iCurrentMergeStart).ClearContents
>>>>>>
>>>>>> rather than a method to physically delete the name from the Names
>>>>>> collection. But then again, you might be right as the question was
>>>>>> not very
>>>>>> clearly stated to me.
>>>>>>
>>>>>> Rick
>>>>>>
>>>>>>
>>>>>> "FSt1" <(E-Mail Removed)> wrote in message
>>>>>> news:CD20FF20-FEB2-4592-B0B6-(E-Mail Removed)...
>>>>>> > hi
>>>>>> > is iCurrentMergeStart the name? if so then....
>>>>>> > ActiveWorkbook.Names("iCurrentMergeStart").Delete
>>>>>> >
>>>>>> > regards
>>>>>> > FSt1
>>>>>> >
>>>>>> > "greg" wrote:
>>>>>> >
>>>>>> >> I know this code below will clear the text in a row.
>>>>>> >> But it will not clear out the named cells.
>>>>>> >> Is there a way to clear both?
>>>>>> >>
>>>>>> >>
>>>>>> >> Rows(CStr(iCurrentMergeStart & ":" &
>>>>>> >> iCurrentMergeStart)).ClearContents
>>>>>> >>
>>>>>> >>
>>>>>> >>
>>>>>>
>>>>>>
>>>>
>>>>
>>>

>>
>>

>



 
Reply With Quote
 
Rick Rothstein \(MVP - VB\)
Guest
Posts: n/a
 
      19th Apr 2008
Okay, you are using named cells the same way I am, so that is good. Now, to
repeat my question about the named cells... do you want to delete only the
named cells on the worksheet that you are on, or do you want to remove every
named cell in the workbook (no matter what worksheet they are on)?

Rick


"greg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> yes, maybe I am being confusing.
>
> I think of a named cell as you can give a cell a specific name. such as
> C5. and that is MySpecialC5. or something like that. where you can do a
> Range("MySpecialC5")
>
> So I have a row of text and cells that have been "named".
> the Rows(CStr("5:5")).ClearContents
> can remove the text in row 5. but the named cells are still there.
> is there a way to remove both text and the named cells?
> thanks for all the help
>
>
> "Rick Rothstein (MVP - VB)" <(E-Mail Removed)> wrote in
> message news:(E-Mail Removed)...
>>I think I am confused at what you want. Excel has a feature whereby you
>>can give a range (one or more cells) a Name and then use that name to
>>refer to the range rather than using the range's address. When I just
>>asked you about removing "named cells", you responded with this example...
>>
>> >

>> which isn't using a named range at all. That leads me to think you are
>> using the term "named cell" for something other than Excel's named ranges
>> (remember, that range can be a single cell which would make it a named
>> cell). Is that the case? If so, can you explain what you mean when you
>> say "named cell"... exactly what are you referring to when you say that?
>>
>> Rick
>>
>>
>> "greg" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> just one row.
>>> so
>>> Rows(CStr("5:5")).ClearContents
>>>
>>> "Rick Rothstein (MVP - VB)" <(E-Mail Removed)> wrote
>>> in message news:(E-Mail Removed)...
>>>> Remove "all" the named cells on a single worksheet (the one whose row
>>>> you cleared) or throughout your entire workbook?
>>>>
>>>> Rick
>>>>
>>>>
>>>> "greg" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> Hello,
>>>>> Thanks for the help.
>>>>>
>>>>> Yes, clear the data and named cell.
>>>>> I really don't want to delete the row. But clear the data. and also
>>>>> remove all the named cells.
>>>>>
>>>>>
>>>>> "FSt1" <(E-Mail Removed)> wrote in message
>>>>> news:14B4D330-3B34-40B8-9920-(E-Mail Removed)...
>>>>>> hi
>>>>>> you may be right. but from his title "clear data AND Named cell", i
>>>>>> assumed
>>>>>> that was what it wanted. he is already clearing the data. and i did
>>>>>> ask. is
>>>>>> that the name? question not clearly stated
>>>>>>
>>>>>> Regards
>>>>>> FSt1
>>>>>>
>>>>>> "Rick Rothstein (MVP - VB)" wrote:
>>>>>>
>>>>>>> If you are right and iCurrentMergeStart is the name given to a named
>>>>>>> range,
>>>>>>> then I would think (based on how the OP phrased his message) that he
>>>>>>> would
>>>>>>> be looking for this...
>>>>>>>
>>>>>>> Range("iCurrentMergeStart").ClearContents
>>>>>>>
>>>>>>> or, if iCurrentMergeStart is a variable containing the name, then
>>>>>>> this...
>>>>>>>
>>>>>>> Range(iCurrentMergeStart).ClearContents
>>>>>>>
>>>>>>> rather than a method to physically delete the name from the Names
>>>>>>> collection. But then again, you might be right as the question was
>>>>>>> not very
>>>>>>> clearly stated to me.
>>>>>>>
>>>>>>> Rick
>>>>>>>
>>>>>>>
>>>>>>> "FSt1" <(E-Mail Removed)> wrote in message
>>>>>>> news:CD20FF20-FEB2-4592-B0B6-(E-Mail Removed)...
>>>>>>> > hi
>>>>>>> > is iCurrentMergeStart the name? if so then....
>>>>>>> > ActiveWorkbook.Names("iCurrentMergeStart").Delete
>>>>>>> >
>>>>>>> > regards
>>>>>>> > FSt1
>>>>>>> >
>>>>>>> > "greg" wrote:
>>>>>>> >
>>>>>>> >> I know this code below will clear the text in a row.
>>>>>>> >> But it will not clear out the named cells.
>>>>>>> >> Is there a way to clear both?
>>>>>>> >>
>>>>>>> >>
>>>>>>> >> Rows(CStr(iCurrentMergeStart & ":" &
>>>>>>> >> iCurrentMergeStart)).ClearContents
>>>>>>> >>
>>>>>>> >>
>>>>>>> >>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>

>>

>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clear cell data using Combo Box =?Utf-8?B?U2NvdHQgS2luZw==?= Microsoft Excel Programming 1 18th Jul 2007 09:14 PM
Re: get data from a cell in each named range Arvi Laanemets Microsoft Excel Worksheet Functions 4 21st Dec 2006 12:11 PM
Macro to clear cell data without clearing headings =?Utf-8?B?RE9PR0lF?= Microsoft Excel Programming 3 19th Jul 2006 01:43 PM
VBA Macro to Clear Named Cell Contents marajr@peelregion.ca Microsoft Excel Programming 3 3rd Jan 2006 08:42 PM
How can I clear all cell data EXCEPT formulas? Gregg Hill Microsoft Excel Discussion 1 21st Aug 2004 04:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:31 PM.