View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Keyboard Macros

Jim,

You can use the HasFormula property to determine whether a cell contains a
formula. E.g.,

If ActiveCell.HasFormula = True Then
' do something
End If


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Jim Carlock" wrote in message
...
In addition to determining if the cell is absolutely or relatively
referenced, what's the suggested mannerism for determining
if there's a formula in the cell?

If (cell holds a formula) Then
If (cell is relatively referenced) Then
ActiveCell.Formula = Application.ConvertFormula( _
ActiveCell.Formula, _
FromReferenceStyle:=xlA1, _
ToAbsolute:=True)
Else
ActiveCell.Formula = Application.ConvertFormula( _
ActiveCell.Formula, _
FromReferenceStyle:=xlA1, _
ToAbsolute:=False)
End If
End If

--
Jim Carlock
http://www.microcosmotalk.com
Feel free to post back to the newsgroup!


"Jim Carlock" wrote in message
...
Thanks Chip.

Ended up using the following to get what I wanted.

ActiveCell.Formula = Application.ConvertFormula( _
ActiveCell.Formula, _
FromReferenceStyle:=xlA1, _
ToAbsolute:=True)

Took me a while to figure out that xlA1 wasn't a cell and that it
was a style of referencing cells. I was going nuts wondering why
you gave an example that referenced Cell ("A1").

Now I'm wondering how to get to the ToAbsolute information
so that I can read that information.

--
Jim Carlock
http://www.microcosmotalk.com
Feel free to post back to the newsgroup!


"Chip Pearson" wrote in message
...
You can use the Application.ConvertFormula method to change a formulas
reference style.


Range("A1").Formula = Application.ConvertFormula(Range("A1").Formula,

_
FromReferenceStyle:=xlA1, ToAbsolute:=True)



--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com