If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > code to change formula in cells doesn't work

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-20-04, 21:41
bohica bohica is offline
Registered User
 
Join Date: Feb 2004
Posts: 1
code to change formula in cells doesn't work

I am trying to write a script so that when a user clicks on a radio button the formula in a cell changes.

my code is
Range("d10").Select
ActiveCell.FormulaR1C1 = "=(B10/C10)+(30/60)"

but when I click on the button the formula entered is
=('B10'/$K:$K)+(45/60)

why and how do i fix it??

Thanks
Reply With Quote
  #2 (permalink)  
Old 02-25-04, 11:28
DavidCoutts DavidCoutts is offline
Registered User
 
Join Date: Jan 2004
Location: Aberdeen, Scotland
Posts: 1,067
Re: code to change formula in cells doesn't work

Quote:
Originally posted by bohica
I am trying to write a script so that when a user clicks on a radio button the formula in a cell changes.

my code is
Range("d10").Select
ActiveCell.FormulaR1C1 = "=(B10/C10)+(30/60)"

but when I click on the button the formula entered is
=('B10'/$K:$K)+(45/60)

why and how do i fix it??

Thanks
Hi

only a small change needs to be made here instead of using
ActiveCell.FormulaR1C1 = etc.
use
ActiveCell.Formula = etc.
the C reference in your formula is getting interpreted as a column i.e. K

I hope this sorts your problem for you

David
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On