View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default VBA controlled conditional format

Change your formula to the form

=if(E1="","",Vlookup(E1,F1:G35,2,0))


for the above

activecell.Formula = "=IF(E1="""","""",Vlookup(E1,F1:G35,2,0))"

just to illustrate how you would enter "" inside your string.

--
Regards,
Tom Ogilvy



"Paul" <paulm dot c @ iol dot ie wrote in message
...
Hi,

I'm using a small script to copy a formula down to certain cells based on

an
option button selection by the user. For example (this is the code for one
of the option buttons)

Private Sub Opt20_Click()
Dim wks
Set wks = Worksheets("Interface")
wks.Range("f13:f1000").ClearContents
For x = 13 To 32
AccDesc = "=VLOOKUP($E$" & x & " ,[Data.xls]SAP_COA_Map!$D:$E,2)"
wks.Range("f" & x) = AccDesc
Next x
Set wks = Nothing
End Sub

When the user selects this button the formula is copied down and each cell
is calculated and a value is return. The problem here is that the user

will
select the button before anything is entered into cell range E:E with the
result that the cells displays "#N/A" because the formula doesn't have
anything to work with.

Using code how do I hide the result in the cell if it is #N/A

Thanks

Paul