Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default Setting Cells Equal only if Destination Cell Does Not Have a Formu

Is there a way in VBA to set a cell equal to another cell only if the
destination cell does not contain a formula (has a value)?

Thanks

Adam Bush
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,058
Default Setting Cells Equal only if Destination Cell Does Not Have a Formu

Yes. Here we check A2 to make sure it has not formula:

Sub save_formula()
Set a1 = Range("A1")
Set a2 = Range("A2")
If a2.HasFormula Then
Else
a2.Value = a1.Value
End If
End Sub

--
Gary''s Student - gsnu200784


" wrote:

Is there a way in VBA to set a cell equal to another cell only if the
destination cell does not contain a formula (has a value)?

Thanks

Adam Bush

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 168
Default Setting Cells Equal only if Destination Cell Does Not Have a F

Gary,

Thanks you very much. I did not know that hasformula was a property.

Thanks

Adam Bush

"Gary''s Student" wrote:

Yes. Here we check A2 to make sure it has not formula:

Sub save_formula()
Set a1 = Range("A1")
Set a2 = Range("A2")
If a2.HasFormula Then
Else
a2.Value = a1.Value
End If
End Sub

--
Gary''s Student - gsnu200784


" wrote:

Is there a way in VBA to set a cell equal to another cell only if the
destination cell does not contain a formula (has a value)?

Thanks

Adam Bush

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
How do I make a range of cells equal to one cell jggsfl Excel Discussion (Misc queries) 2 December 20th 07 10:01 PM
Displaying 'IF' Function result (text) over cells containing formu MML Excel Worksheet Functions 1 June 21st 07 09:17 AM
Cells equal to another cell a certain # over Fin Analyst Excel Discussion (Misc queries) 6 April 11th 06 11:46 PM
Setting a cell equal to another worksheet cell fails (sometimes) Richard Excel Worksheet Functions 2 March 10th 06 04:11 AM
How do I make a cell equal to another cells value and not it's fo. TroutKing Excel Worksheet Functions 2 January 17th 05 06:15 PM


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