Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Formula Array through VBA

Status
Not open for further replies.

brage98

IS-IT--Management
Sep 8, 2010
27
CA
We have an excel sheet with 4 or 5 different FormulaArrays.

Now we have to (why? long story, we just have to) remove this formulaArray (I need to repopulate the same region with some new data)

The process of deleting the formulaArray needs to be automated through vba code (why? again, long story!)

The question is how can I delete a formula array through VBA?

I've started off with something like this, but it's not quite there yet:
Code:
Dim rng As Range
Set rng = wsIndexData.Range(wsIndexData.Cells(iStartRowIndex, iStartColIndex), wsIndexData.Cells(iStartRowIndex + 10000, iStartColIndex + 4))
rng.CurrentArray.Delete

Thanks!
 



Hi,

Why not start with the FORMULAS from your "4 or 5 different FormulaArrays" and use the Find method?

Loop thru each of the formulas to find the range and replace with whatever.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 



or why wouldn't this work?
Code:
'...
rng.ClearContents


Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
hey,
thanks for the reply

rng.Clearncontents doesn't work because I get the "You cannot change part of an array" error

as for your first suggestion, do you mind posting a simple code-example please

thanks!
 
k, thanks for your help... Turns out I was off in my range selection (off by 1). Once I found the correct range, I tried the following and it works:

Code:
wsIndexData.Range(wsIndexData.Cells(2, 1), wsIndexData.Cells(500, 5)).FormulaArray = Null

cheers!


 


I may have understood you.

What is a 'FormulaArrays?'

I know what an array formula is.

Please post one of the formulaarrays that you refer to.

Please state the range in which this entity resides.

Please describe the cells that are contrguous to this range.

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
To search whole worksheet and clear arrays:
Code:
For Each Cell In wsIndexData.UsedRange
    If Cell.HasArray Then Cell.CurrentArray.ClearContents
Next Cell

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top