#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 313
Default VBA Cell Formula

I need to have the following code enter via VBA into a cell:

=IF(AH6="Active","",AH6)

I tried using the following but received an error:

wsPh.Range("ah" & Emcnt).Formula = "=if(ah" & Emcnt & ="Active"","" & ,"ah"
& Emcnt"")"

Can someone help me out here? Also, is there somewhere where I can see the
actual code format such a statement?

Many thanks,

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default VBA Cell Formula

Range("A1").formula= "=IF(AH6=" & Chr(34) & "Active" & Chr(34) & "," &
Chr(34) & chr(34) & ",AH6)"

If this post helps click Yes
---------------
Jacob Skaria


"Tony" wrote:

I need to have the following code enter via VBA into a cell:

=IF(AH6="Active","",AH6)

I tried using the following but received an error:

wsPh.Range("ah" & Emcnt).Formula = "=if(ah" & Emcnt & ="Active"","" & ,"ah"
& Emcnt"")"

Can someone help me out here? Also, is there somewhere where I can see the
actual code format such a statement?

Many thanks,

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 449
Default VBA Cell Formula

Record a macro while entering the formula manually.

HTH. Best wishes Harald

"Tony" wrote in message
...
I need to have the following code enter via VBA into a cell:

=IF(AH6="Active","",AH6)

I tried using the following but received an error:

wsPh.Range("ah" & Emcnt).Formula = "=if(ah" & Emcnt & ="Active"","" &
,"ah"
& Emcnt"")"

Can someone help me out here? Also, is there somewhere where I can see the
actual code format such a statement?

Many thanks,


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default VBA Cell Formula

hi
try this..
wsPh.Range("ah" & Emcnt).Formula = _
"=if(AH" & Emcnt & " =""Active"","",AH" & Emcnt & ")"

REgards
FSt1

"Tony" wrote:

I need to have the following code enter via VBA into a cell:

=IF(AH6="Active","",AH6)

I tried using the following but received an error:

wsPh.Range("ah" & Emcnt).Formula = "=if(ah" & Emcnt & ="Active"","" & ,"ah"
& Emcnt"")"

Can someone help me out here? Also, is there somewhere where I can see the
actual code format such a statement?

Many thanks,

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 8,520
Default VBA Cell Formula

Range("A1").formula= "=IF(AH6=""Active"","""",AH6)"

If this post helps click Yes
---------------
Jacob Skaria


"Tony" wrote:

I need to have the following code enter via VBA into a cell:

=IF(AH6="Active","",AH6)

I tried using the following but received an error:

wsPh.Range("ah" & Emcnt).Formula = "=if(ah" & Emcnt & ="Active"","" & ,"ah"
& Emcnt"")"

Can someone help me out here? Also, is there somewhere where I can see the
actual code format such a statement?

Many thanks,



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 313
Default VBA Cell Formula

Your statement came closest to the text formula I was using, but I am
receiving a run time 1004 error when I run the code. Any suggestions?

"FSt1" wrote:

hi
try this..
wsPh.Range("ah" & Emcnt).Formula = _
"=if(AH" & Emcnt & " =""Active"","",AH" & Emcnt & ")"

REgards
FSt1

"Tony" wrote:

I need to have the following code enter via VBA into a cell:

=IF(AH6="Active","",AH6)

I tried using the following but received an error:

wsPh.Range("ah" & Emcnt).Formula = "=if(ah" & Emcnt & ="Active"","" & ,"ah"
& Emcnt"")"

Can someone help me out here? Also, is there somewhere where I can see the
actual code format such a statement?

Many thanks,

  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default VBA Cell Formula

opps. my bad.

wsPh.Range("ah" & emcnt).Formula = _
"=IF(AH" & emcnt & " =""Active"","""",AH" & emcnt & ")"

i forgot to put quotes around the quotes for the then part.

sorry.
regards
FSt1

"Tony" wrote:

Your statement came closest to the text formula I was using, but I am
receiving a run time 1004 error when I run the code. Any suggestions?

"FSt1" wrote:

hi
try this..
wsPh.Range("ah" & Emcnt).Formula = _
"=if(AH" & Emcnt & " =""Active"","",AH" & Emcnt & ")"

REgards
FSt1

"Tony" wrote:

I need to have the following code enter via VBA into a cell:

=IF(AH6="Active","",AH6)

I tried using the following but received an error:

wsPh.Range("ah" & Emcnt).Formula = "=if(ah" & Emcnt & ="Active"","" & ,"ah"
& Emcnt"")"

Can someone help me out here? Also, is there somewhere where I can see the
actual code format such a statement?

Many thanks,

  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 313
Default VBA Cell Formula

That works like a charm. Much appreciated!

Tony

"FSt1" wrote:

opps. my bad.

wsPh.Range("ah" & emcnt).Formula = _
"=IF(AH" & emcnt & " =""Active"","""",AH" & emcnt & ")"

i forgot to put quotes around the quotes for the then part.

sorry.
regards
FSt1

"Tony" wrote:

Your statement came closest to the text formula I was using, but I am
receiving a run time 1004 error when I run the code. Any suggestions?

"FSt1" wrote:

hi
try this..
wsPh.Range("ah" & Emcnt).Formula = _
"=if(AH" & Emcnt & " =""Active"","",AH" & Emcnt & ")"

REgards
FSt1

"Tony" wrote:

I need to have the following code enter via VBA into a cell:

=IF(AH6="Active","",AH6)

I tried using the following but received an error:

wsPh.Range("ah" & Emcnt).Formula = "=if(ah" & Emcnt & ="Active"","" & ,"ah"
& Emcnt"")"

Can someone help me out here? Also, is there somewhere where I can see the
actual code format such a statement?

Many thanks,

  #9   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default VBA Cell Formula

you're welcome. glad to help.

regards
FSt1

"Tony" wrote:

That works like a charm. Much appreciated!

Tony

"FSt1" wrote:

opps. my bad.

wsPh.Range("ah" & emcnt).Formula = _
"=IF(AH" & emcnt & " =""Active"","""",AH" & emcnt & ")"

i forgot to put quotes around the quotes for the then part.

sorry.
regards
FSt1

"Tony" wrote:

Your statement came closest to the text formula I was using, but I am
receiving a run time 1004 error when I run the code. Any suggestions?

"FSt1" wrote:

hi
try this..
wsPh.Range("ah" & Emcnt).Formula = _
"=if(AH" & Emcnt & " =""Active"","",AH" & Emcnt & ")"

REgards
FSt1

"Tony" wrote:

I need to have the following code enter via VBA into a cell:

=IF(AH6="Active","",AH6)

I tried using the following but received an error:

wsPh.Range("ah" & Emcnt).Formula = "=if(ah" & Emcnt & ="Active"","" & ,"ah"
& Emcnt"")"

Can someone help me out here? Also, is there somewhere where I can see the
actual code format such a statement?

Many thanks,

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
How can I make a blank cell in a formula cell with a range of cell Vi Excel Discussion (Misc queries) 5 June 21st 07 02:46 PM
copy formula down a column and have cell references change within formula brad New Users to Excel 5 May 13th 07 04:38 PM
adding a formula in a cell but when cell = 0 cell is blank Mike T Excel Worksheet Functions 5 May 31st 05 01:08 AM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 1 February 11th 05 06:36 AM
Cell Formula reference to cell Based On third Cell Content Gabriel Excel Discussion (Misc queries) 0 February 11th 05 05:35 AM


All times are GMT +1. The time now is 12:54 PM.

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"