Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Macro to Clear Named Cell Contents

I have a workbook with approx. 30 named cells. They all start with
"clr_". I'm looking for some script that would look for all named cells
beginning with "clr_" and then go through to delete the content of that
named cell. for example "clr_projectname" would have the words "my
project name" and i would like the script to go through and delete the
words "my project name" from the cell and then go through looking for
the next name beginning with "clr_" and delete the contents of that
cell. HELPPPPPP PLZ.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA Macro to Clear Named Cell Contents

Try this, just drop this into VBA

Sub RemoveRange
Dim nm As Name

For Each nm In ActiveWorkbook.Names
Debug.Print nm.Name & " refers to " & nm.RefersTo
If InStr(1, nm.Name, "clr_") 0 Then
Range(nm.Name).ClearContents
End If
Next nm

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA Macro to Clear Named Cell Contents

Dim nme As Name

For Each nme In ActiveWorkbook.Names
If Left(nme.Name, 4) = "clr_" Then
Range(nme.Name).ClearContents
End If
Next nme


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

wrote in message
oups.com...
I have a workbook with approx. 30 named cells. They all start with
"clr_". I'm looking for some script that would look for all named cells
beginning with "clr_" and then go through to delete the content of that
named cell. for example "clr_projectname" would have the words "my
project name" and i would like the script to go through and delete the
words "my project name" from the cell and then go through looking for
the next name beginning with "clr_" and delete the contents of that
cell. HELPPPPPP PLZ.



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
Macro to clear contents of certain cells MrAcquire Excel Discussion (Misc queries) 3 February 11th 10 05:25 PM
Macro to clear contents and put an X bevchapman Excel Discussion (Misc queries) 3 March 17th 09 07:03 PM
VBA Excel Macro to delete contents in named cell reaa Excel Discussion (Misc queries) 1 January 3rd 06 08:16 PM
Clear Contents Macro SJC Excel Worksheet Functions 3 October 27th 05 07:26 PM
MACRO TO CLEAR CELL CONTENTS Jay Dean Excel Programming 2 October 11th 03 02:51 PM


All times are GMT +1. The time now is 04:29 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"