Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 29
Default Need to re-initialize cell with original formula

During an initialization process, I need to reset some cells to their
original formula(s). I tried the following w/o success. The cell contents
show as text afterwards rather than formulas. Help.
Jim

' Reset Session formulas to Full Night
Dim SessionCompareE3 As String
Dim SessionCompareF3 As String

SessionCompareE3 = "=COUNTIF(D8:D25000,"" ""&B1)"
Range("$E$3").Select
ActiveCell.FormulaR1C1 = SessionCompareE3
SessionCompareF3 = "=COUNTIF(D8:D25000,"" < ""&C2)"
Range("$F$3").Select
ActiveCell.FormulaR1C1 = SessionCompareF3

  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 2,489
Default Need to re-initialize cell with original formula

Hi,

You are mixing cell reference types.
You use A1 notation to construct the formula string. But then assign it
to the R1C1 formula property.
Instead try,

ActiveCell.Formula = SessionCompareE3

You also need to remove the spaces from around the greater than sign.

SessionCompareE3 = "=COUNTIF(D8:D25000,""""&B1)"

Cheers
Andy

Cinco wrote:
During an initialization process, I need to reset some cells to their
original formula(s). I tried the following w/o success. The cell contents
show as text afterwards rather than formulas. Help.
Jim

' Reset Session formulas to Full Night
Dim SessionCompareE3 As String
Dim SessionCompareF3 As String

SessionCompareE3 = "=COUNTIF(D8:D25000,"" ""&B1)"
Range("$E$3").Select
ActiveCell.FormulaR1C1 = SessionCompareE3
SessionCompareF3 = "=COUNTIF(D8:D25000,"" < ""&C2)"
Range("$F$3").Select
ActiveCell.FormulaR1C1 = SessionCompareF3


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 29
Default Need to re-initialize cell with original formula

Andy,
Your suggestions worked perfectly. Thanks.

Without any VBA background, I'm trying to learn things (especially when what
I try doesn't work and I become frustrated) by searching and reading posts on
this website. It is a slow process but, so far, no show stoppers!
Jim

"Andy Pope" wrote:

Hi,

You are mixing cell reference types.
You use A1 notation to construct the formula string. But then assign it
to the R1C1 formula property.
Instead try,

ActiveCell.Formula = SessionCompareE3

You also need to remove the spaces from around the greater than sign.

SessionCompareE3 = "=COUNTIF(D8:D25000,""""&B1)"

Cheers
Andy

Cinco wrote:
During an initialization process, I need to reset some cells to their
original formula(s). I tried the following w/o success. The cell contents
show as text afterwards rather than formulas. Help.
Jim

' Reset Session formulas to Full Night
Dim SessionCompareE3 As String
Dim SessionCompareF3 As String

SessionCompareE3 = "=COUNTIF(D8:D25000,"" ""&B1)"
Range("$E$3").Select
ActiveCell.FormulaR1C1 = SessionCompareE3
SessionCompareF3 = "=COUNTIF(D8:D25000,"" < ""&C2)"
Range("$F$3").Select
ActiveCell.FormulaR1C1 = SessionCompareF3


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

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
Copying a formula from original cell to mutilpe cells? Lisa Excel Discussion (Misc queries) 3 July 10th 09 08:38 AM
Copy rows but need to refer to same cell in original formula addison Excel Worksheet Functions 4 April 4th 08 04:29 PM
formula copies value from original cell only smaem Excel Worksheet Functions 2 March 20th 08 07:42 PM
Userform Initialize & combo box values michaelberrier Excel Discussion (Misc queries) 3 June 27th 06 04:35 PM
copied formula has correct cell reference, but result of original lvito Excel Worksheet Functions 1 October 14th 05 04:37 PM


All times are GMT +1. The time now is 01:37 AM.

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"