Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Insert formula into a cell doesn't work :S


If got this piece of code:

For x = 5 To 10
Range("D" & x).Formula = "=COUNTIF(PEN!$G:$G;$B" & x & " &
\"CO\")"
Next x

Should result in:
=COUNTIF(PEN!$G:$G;$B5 & "CO") in cell D5
...
=COUNTIF(PEN!$G:$G;$B10 & "CO") in cell D10

But it doesn't do the trick... someone who knows how to make it work?!
Thanks in advance!!

Steven


--
s80NL


------------------------------------------------------------------------
s80NL's Profile: http://www.excelforum.com/member.php...o&userid=36374
View this thread: http://www.excelforum.com/showthread...hreadid=572699

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 459
Default Insert formula into a cell doesn't work :S

"s80NL" ha scritto nel
messaggio ...

If got this piece of code:

For x = 5 To 10
Range("D" & x).Formula = "=COUNTIF(PEN!$G:$G;$B" & x & " &
\"CO\")"
Next x

Should result in:
=COUNTIF(PEN!$G:$G;$B5 & "CO") in cell D5
..
=COUNTIF(PEN!$G:$G;$B10 & "CO") in cell D10

But it doesn't do the trick... someone who knows how to make it work?!
Thanks in advance!!

Steven


Hi Steven,

try without the slash, so you will have:

Range("D" & x).Formula = "=COUNTIF(PEN!$G:$G;$B" & x & ""CO")"



--
Hope I helped you.

Thanks in advance for your feedback.

Ciao

Franz Verga from Italy


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Insert formula into a cell doesn't work :S

Sub a()
For x = 5 To 10
Range("D" & x).Formula = _
"=COUNTIF(PEN!$G:$G,$B" & x & "&""CO"")"
Next x

End Sub

Also, note that I use a comma instead of a semicolon. When you use Formula,
you should enter the formula using US English conventions.

--
Regards,
Tom Ogilvy


"s80NL" wrote:


If got this piece of code:

For x = 5 To 10
Range("D" & x).Formula = "=COUNTIF(PEN!$G:$G;$B" & x & " &
\"CO\")"
Next x

Should result in:
=COUNTIF(PEN!$G:$G;$B5 & "CO") in cell D5
...
=COUNTIF(PEN!$G:$G;$B10 & "CO") in cell D10

But it doesn't do the trick... someone who knows how to make it work?!
Thanks in advance!!

Steven


--
s80NL


------------------------------------------------------------------------
s80NL's Profile: http://www.excelforum.com/member.php...o&userid=36374
View this thread: http://www.excelforum.com/showthread...hreadid=572699


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
Insert a formula into the last row of a cell RoVo Excel Programming 2 August 2nd 06 09:19 PM
Insert Formula in Cell with VBA Ctech[_137_] Excel Programming 1 April 5th 06 11:27 AM
Using VBA to Insert a formula in a cell Lee Excel Programming 2 March 17th 06 01:23 AM
Insert value of formula into cell Bill Excel Programming 16 August 1st 05 06:16 PM
insert formula in last cell J_Gold Excel Programming 6 May 31st 05 03:14 AM


All times are GMT +1. The time now is 03:22 PM.

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

About Us

"It's about Microsoft Excel"