Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Determining whether selected cell has value or formula?

I have a simple question. in VBA, how can one determine whether the
currently selected cell has a value or a formla in it?

John Wirt


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Determining whether selected cell has value or formula?

John,

Use the HasFormula property. E.g.,

If Range("A1").HasFormula = True Then
' cell has formula
Else
' cell doesn't have formula
End If


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


"John Wirt" wrote in message
...
I have a simple question. in VBA, how can one determine whether

the
currently selected cell has a value or a formla in it?

John Wirt




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Determining whether selected cell has value or formula?

Thank you, Chip. I will note this one for the future.

John

"Chip Pearson" wrote in message
...
John,

Use the HasFormula property. E.g.,

If Range("A1").HasFormula = True Then
' cell has formula
Else
' cell doesn't have formula
End If


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


"John Wirt" wrote in message
...
I have a simple question. in VBA, how can one determine whether

the
currently selected cell has a value or a formla in it?

John Wirt






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Determining whether selected cell has value or formula?

If I include this before the statement where I want to obtain the formula in
a cell, I will be able to only select when the cell contains a formula. The
program will be better.

John

"Chip Pearson" wrote in message
...
John,

Use the HasFormula property. E.g.,

If Range("A1").HasFormula = True Then
' cell has formula
Else
' cell doesn't have formula
End If


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


"John Wirt" wrote in message
...
I have a simple question. in VBA, how can one determine whether

the
currently selected cell has a value or a formla in it?

John Wirt






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
Multiple cells or columns are selected instead of selected cell or Mikey Excel Discussion (Misc queries) 1 April 29th 09 09:48 PM
Is there a formula to show which cell is currently selected Chris Excel Worksheet Functions 4 May 8th 06 03:33 PM
A formula for displaying the cell reference of the selected cell Emlou85 via OfficeKB.com Excel Discussion (Misc queries) 3 March 19th 06 03:54 PM
need help with determining a formula Cal Excel Worksheet Functions 2 November 11th 05 01:49 PM
Determining if a chart is selected [email protected] Charts and Charting in Excel 2 January 25th 05 03:06 PM


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