View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rob van Gelder[_4_] Rob van Gelder[_4_] is offline
external usenet poster
 
Posts: 1,236
Default Macro to enter formula with text

That's pretty frustrating converting from text mode.
Originally, I would press F2 then Enter for as many cells as I would need to
change.
After a while I found a quicker way - I don't know if there is an easier
way - probably is.

Go to formula mode: Tools | Options | Window options - Formulas = ticked
(shortcut key is Ctrl ~)
Highlight the column | Edit | Copy.
Open Notepad
Paste
Select All
Copy
Go back to Excel, Paste - take care to make sure it pasted in the same
position.
untick formula mode


If you really want to be building your formula, you could do something like:
="=COUNTIF(A$2:A$374,""" & B2 & """)"
Where B2 = RM02
Then fill the formula down. Copy the result into Notepad, then copy them
back to Excel which will then accept them as a formula


Rob


"bambam77" wrote in message
...
For some reason when I execute my macro, my formulas which include text
won't update unless I select the cell and then click in the formula bar
and then hit enter. It was suggested by someone here to therefore
create a macro that will re-install the formulas.

Is there a way to write code to install a formula like this for several
cells : =COUNTIF(A$2:A$374,"RM01"). The only thing that changes in the
formula is the text. For each cell the text changes by a value of 1.

For example:
=COUNTIF(A$2:A$374,"RM02")
=COUNTIF(A$2:A$374,"RM03")
=COUNTIF(A$2:A$374,"RM04").........and so on.

Is there some kind of loop or something I can use to make writing this
code less tedious???

Thanks and Happy new year.


---
Message posted from http://www.ExcelForum.com/