Results 1 to 6 of 6

Thread: removing a formula from a cell in excel

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    removing a formula from a cell in excel

    Hello
    I was trying to remove a formula from a cell in excel, till now i have come up with the following

    mytype.Worksheets("mytypes").Cells(6 , 6).value = "0"

    where the cell (6,6) had the formula, this however leaves the formula updated with the value '0' in place.

  2. #2
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202

    Re: removing a formula from a cell in excel

    if you select the cell first and use:

    Code:
    Selection.ClearContents
    if you fail to plan, you plan to fail

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    Re: removing a formula from a cell in excel

    thanks for the reply
    how do i select the cell from VB?

  4. #4
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202

    Re: removing a formula from a cell in excel

    Code:
    Range("A1").select
    if you fail to plan, you plan to fail

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2005
    Posts
    1,069

    Re: removing a formula from a cell in excel

    i got the following code

    Code:
        Set excel_doc = GetObject("D:\TEST\excel_doc.xls")
        excel_doc.Worksheets("NodeBtypes").Range("E20").Select
        Selection.ClearContents
    but the third line(i think) throws up the following error

    "run time error '424'
    Object required"


    also i was wondering if i can specify the cell like say

    Code:
    excel_doc.Worksheets("NodeBtypes").cell(20,5).Select

  6. #6
    Addicted Member
    Join Date
    Jan 2002
    Location
    Glasgow, Scotland
    Posts
    202

    Re: removing a formula from a cell in excel

    sorry,

    The

    Code:
    Selection.clearcontents
    works from within Excel

    have a look at this thread for an idea how to reference cells from VB:

    Programming Excel from VB6
    if you fail to plan, you plan to fail

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width