Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Worksheet Functions / October 2006

Tip: Looking for answers? Try searching our database.

Macro To Change a Formula to A Value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
carl - 13 Oct 2006 07:50 GMT
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.
Stefi - 13 Oct 2006 08:03 GMT
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.
>
[quoted text clipped - 4 lines]
>
> Thank you in advance.
Bob Phillips - 13 Oct 2006 09:21 GMT
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

Signature

HTH

Bob Phillips

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

> Sub changetoval()
>     Range("B2:B8").Select   'ADJUST RANGE!
[quoted text clipped - 18 lines]
> >
> > Thank you in advance.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.