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.
Re: removing a formula from a cell in excel
if you select the cell first and use:
Code:
Selection.ClearContents
Re: removing a formula from a cell in excel
thanks for the reply
how do i select the cell from VB?
Re: removing a formula from a cell in excel
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
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