Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 361
Default Macro To Change a Formula to A Value

I have a formula in ColB of my worksheet.

The value of the formula will be zero or a positive number.

Is it possible for a macro to change the formula to its value if the value
is not equal to zero ?

Thank you in advance.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,646
Default Macro To Change a Formula to A Value

Sub changetoval()
Range("B2:B8").Select 'ADJUST RANGE!
For Each cella In Selection
If cella < 0 Then
cella.Value = cella
End If
Next cella
End Sub

Regards,
Stefi


€˛carl€¯ ezt Ć*rta:

I have a formula in ColB of my worksheet.

The value of the formula will be zero or a positive number.

Is it possible for a macro to change the formula to its value if the value
is not equal to zero ?

Thank you in advance.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Macro To Change a Formula to A Value

Stefi,

No need to do wasteful selecting

Sub changetoval()
For Each cella In Range("B2:B8") 'ADJUST RANGE!
If cella < 0 Then
cella.Value = cella.Value
End If
Next cella
End Sub


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Stefi" wrote in message
...
Sub changetoval()
Range("B2:B8").Select 'ADJUST RANGE!
For Each cella In Selection
If cella < 0 Then
cella.Value = cella
End If
Next cella
End Sub

Regards,
Stefi


"carl" ezt ķrta:

I have a formula in ColB of my worksheet.

The value of the formula will be zero or a positive number.

Is it possible for a macro to change the formula to its value if the

value
is not equal to zero ?

Thank you in advance.



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
Reusing formula Tony29 Excel Discussion (Misc queries) 7 September 7th 06 03:34 AM
error when running cut & paste macro Otto Moehrbach Excel Worksheet Functions 4 August 9th 06 01:49 PM
Running of Worksheet Change Macro breaks undo functionality. Rob Manger Excel Discussion (Misc queries) 1 April 6th 06 04:04 AM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Formula for current month minus one = Quarter number in a macro. Pank Excel Discussion (Misc queries) 11 June 22nd 05 02:47 PM


All times are GMT +1. The time now is 10:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"