![]() |
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, |
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, |
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, |
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, |
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, |
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, |
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, |
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, |
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, |
All times are GMT +1. The time now is 03:26 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com