Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How does everybody write code to delete the contents of
a cell, such as cell "A1"??? I normally use the following code: Range("A1").Value = "" Is that correct?? I get the feeling that I am setting cell "A1" to an empty string, rather than actually deleting the current contents. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Robert
Your method works. Here is another method which gets the job done as well. Range("A1").ClearContents Take care Marcus |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
When I delete the contents of a single cell, I usually use .Value="" as you do, but when I want to delete contents multiple cells, I use .ClearContents which delete the content of the cells. Using .Clear will not only delete the content but also clear any formating in the cell(s). Regards, Per "Robert Crandal" skrev i meddelelsen ... How does everybody write code to delete the contents of a cell, such as cell "A1"??? I normally use the following code: Range("A1").Value = "" Is that correct?? I get the feeling that I am setting cell "A1" to an empty string, rather than actually deleting the current contents. |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
For Excel VBA you can try the clearcontents method for a Range
Range("A1").ClearContents Range("A1")="" does the same as Range("A1") = vbNullString When you mention Range("A1")="" the computer generate a null string....and then assign that value to the cell; whereas vbNullString is a null string and so should be quicker. If this post helps click Yes --------------- Jacob Skaria "Robert Crandal" wrote: How does everybody write code to delete the contents of a cell, such as cell "A1"??? I normally use the following code: Range("A1").Value = "" Is that correct?? I get the feeling that I am setting cell "A1" to an empty string, rather than actually deleting the current contents. . |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
..Value = "" works on multiple cells as well..
"Per Jessen" wrote: Hi When I delete the contents of a single cell, I usually use .Value="" as you do, but when I want to delete contents multiple cells, I use .ClearContents which delete the content of the cells. Using .Clear will not only delete the content but also clear any formating in the cell(s). Regards, Per "Robert Crandal" skrev i meddelelsen ... How does everybody write code to delete the contents of a cell, such as cell "A1"??? I normally use the following code: Range("A1").Value = "" Is that correct?? I get the feeling that I am setting cell "A1" to an empty string, rather than actually deleting the current contents. . |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I know that .Value="" work on multiple cells, but i prefer to use
..ClearContents when working with multiple cells. "Jacob Skaria" skrev i meddelelsen ... .Value = "" works on multiple cells as well.. "Per Jessen" wrote: Hi When I delete the contents of a single cell, I usually use .Value="" as you do, but when I want to delete contents multiple cells, I use .ClearContents which delete the content of the cells. Using .Clear will not only delete the content but also clear any formating in the cell(s). Regards, Per "Robert Crandal" skrev i meddelelsen ... How does everybody write code to delete the contents of a cell, such as cell "A1"??? I normally use the following code: Range("A1").Value = "" Is that correct?? I get the feeling that I am setting cell "A1" to an empty string, rather than actually deleting the current contents. . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
delete contents of cell | Excel Discussion (Misc queries) | |||
Delete cell contents | Excel Discussion (Misc queries) | |||
Delete Cell Contents IF | Excel Programming | |||
Delete all contents of cell but one word | Excel Discussion (Misc queries) | |||
Delete row based on contents of cell | Excel Discussion (Misc queries) |