Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default Is the formula an array formula?

I'd like to insert a cell's formula into a comment. My
only issue is testing to see if it's an array formula or
normal formula. As of now, the macro always says it's an
array formula. Thanks for any help you can provide.

Sub FormulaInComment()
Dim ConfirmBox As String
Dim FormulaType As String
ConfirmBox = MsgBox("Proceed?", vbYesNo)
If ConfirmBox = vbNo Then Exit Sub
With ActiveCell
If .HasFormula Then
If IsNull(.FormulaArray) Then
FormulaType = "Formula:"
Else
FormulaType = "Array Formula:"
End If
Else
MsgBox "No formula in cell!"
Exit Sub
End If
.AddComment
.Comment.Text Text:=FormulaType & Chr(10) & .Formula
.Comment.Visible = False
.Copy
.PasteSpecial (xlPasteValues)
End With
Application.CutCopyMode = False
End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Is the formula an array formula?

Sub FormulaInComment()
Dim ConfirmBox As String
Dim FormulaType As String
ConfirmBox = MsgBox("Proceed?", vbYesNo)
If ConfirmBox = vbNo Then Exit Sub
With ActiveCell
If .HasFormula Then
If Not .HasArray Then
FormulaType = "Formula:"
Else
FormulaType = "Array Formula:"
End If
Else
MsgBox "No formula in cell!"
Exit Sub
End If
.AddComment
.Comment.Text Text:=FormulaType & Chr(10) & .Formula
.Comment.Visible = False
.Copy
.PasteSpecial (xlPasteValues)
End With
Application.CutCopyMode = False
End Sub

--
Regards,
Tom Ogilvy

"Jason Morin" wrote in message
...
I'd like to insert a cell's formula into a comment. My
only issue is testing to see if it's an array formula or
normal formula. As of now, the macro always says it's an
array formula. Thanks for any help you can provide.

Sub FormulaInComment()
Dim ConfirmBox As String
Dim FormulaType As String
ConfirmBox = MsgBox("Proceed?", vbYesNo)
If ConfirmBox = vbNo Then Exit Sub
With ActiveCell
If .HasFormula Then
If IsNull(.FormulaArray) Then
FormulaType = "Formula:"
Else
FormulaType = "Array Formula:"
End If
Else
MsgBox "No formula in cell!"
Exit Sub
End If
.AddComment
.Comment.Text Text:=FormulaType & Chr(10) & .Formula
.Comment.Visible = False
.Copy
.PasteSpecial (xlPasteValues)
End With
Application.CutCopyMode = False
End Sub



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Is the formula an array formula?

I had one of these thingies in a workbook. I thought it would be very useful to
document what happened before (and if I had to revert).

If you're thinking of doing the same thing, you may want to use .formular1c1

I inserted rows (not columns) in my data and every "retrieved" formula was now
pointing at the correct column in the wrong row.

It was not as useful as I hoped.

Jason Morin wrote:

I'd like to insert a cell's formula into a comment. My
only issue is testing to see if it's an array formula or
normal formula. As of now, the macro always says it's an
array formula. Thanks for any help you can provide.

Sub FormulaInComment()
Dim ConfirmBox As String
Dim FormulaType As String
ConfirmBox = MsgBox("Proceed?", vbYesNo)
If ConfirmBox = vbNo Then Exit Sub
With ActiveCell
If .HasFormula Then
If IsNull(.FormulaArray) Then
FormulaType = "Formula:"
Else
FormulaType = "Array Formula:"
End If
Else
MsgBox "No formula in cell!"
Exit Sub
End If
.AddComment
.Comment.Text Text:=FormulaType & Chr(10) & .Formula
.Comment.Visible = False
.Copy
.PasteSpecial (xlPasteValues)
End With
Application.CutCopyMode = False
End Sub


--

Dave Peterson
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
Array formula SUMIF with 2D sum_range array Rich_84 Excel Worksheet Functions 3 April 3rd 09 10:46 PM
Array formula: how to join 2 ranges together to form one array? Rich_84 Excel Worksheet Functions 2 April 1st 09 06:38 PM
Find specific value in array of array formula DzednConfsd Excel Worksheet Functions 2 January 13th 09 06:19 AM
Array Formula - using LEFT("text",4) in formula Andrew L via OfficeKB.com Excel Worksheet Functions 2 August 1st 05 02:36 PM
A formula needed - probably an array formula Jim[_22_] Excel Programming 2 September 1st 03 12:18 AM


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