Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Excel formulae to VBA functions

Hi all, I have the following excel formulae in Cell T10:
" =If (and(or(J10="",istext(J10)),K10=""),"",Sum(K10:S10 )) "
which i would like to convert to a VBA function. The function would
then be copied down 200 rows in Column T.
Your help appreciated. Using XP with XL2003 still newbie but enjoying.
Rgds
KZ
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Excel formulae to VBA functions

Dim sFla As String
sFla = "=IF(AND(OR(J10="""",ISTEXT(J10)),K10=""""),"""",S UM(K10:S10))"
Range("T10:T209").Formula = sFla

Regards,
Peter T

"Kieranz" wrote in message
...
Hi all, I have the following excel formulae in Cell T10:
" =If (and(or(J10="",istext(J10)),K10=""),"",Sum(K10:S10 )) "
which i would like to convert to a VBA function. The function would
then be copied down 200 rows in Column T.
Your help appreciated. Using XP with XL2003 still newbie but enjoying.
Rgds
KZ



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Excel formulae to VBA functions

On Apr 3, 12:14 pm, "Peter T" <peter_t@discussions wrote:
Dim sFla As String
sFla = "=IF(AND(OR(J10="""",ISTEXT(J10)),K10=""""),"""",S UM(K10:S10))"
Range("T10:T209").Formula = sFla

Regards,
Peter T

"Kieranz" wrote in message

...

Hi all, I have the following excel formulae in Cell T10:
" =If (and(or(J10="",istext(J10)),K10=""),"",Sum(K10:S10 )) "
which i would like to convert to a VBA function. The function would
then be copied down 200 rows in Column T.
Your help appreciated. Using XP with XL2003 still newbie but enjoying.
Rgds
KZ


Hi Peter
Tried the above which is a sub procedure that copies the formulae to
the range T10 to T200, what i wanted was a function so that the
formulae is not visible and therefore temperproof.
Many thks
Rgds
KZ
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Excel formulae to VBA functions

On Apr 3, 9:45*pm, Kieranz wrote:
On Apr 3, 12:14 pm, "Peter T" <peter_t@discussions wrote:





Dim sFla As String
sFla = "=IF(AND(OR(J10="""",ISTEXT(J10)),K10=""""),"""",S UM(K10:S10))"
Range("T10:T209").Formula = sFla


Regards,
Peter T


"Kieranz" wrote in message


...


Hi all, I have the following excel formulae in Cell T10:
" =If (and(or(J10="",istext(J10)),K10=""),"",Sum(K10:S10 )) "
which i would like to convert to a VBA function. The function would
then be copied down 200 rows in Column T.
Your help appreciated. Using XP with XL2003 still newbie but enjoying.
Rgds
KZ


Hi Peter
Tried the above which is a sub procedure that copies the formulae to
the range T10 to T200, what i wanted was a function so that the
formulae is not visible and therefore temperproof.
Many thks
Rgds
KZ- Hide quoted text -

- Show quoted text -


Hi Kieranz,

This should do it:

Function IFSUM(CellOne As Range, CellTwo As Range, _
SumRng As Range) As Variant

If (CellOne = vbNullString Or Application.IsText(CellOne)) _
And CellTwo = vbNullString Then _
IFSUM = "" Else IFSUM = Application.Sum(SumRng)

End Function

Use as: =IFSUM(J10,K10,K10:S10)

Cheers,
Ivan.
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Excel formulae to VBA functions

"Kieranz" wrote in message
...
On Apr 3, 12:14 pm, "Peter T" <peter_t@discussions wrote:
Dim sFla As String
sFla = "=IF(AND(OR(J10="""",ISTEXT(J10)),K10=""""),"""",S UM(K10:S10))"
Range("T10:T209").Formula = sFla

Regards,
Peter T

"Kieranz" wrote in message


...

Hi all, I have the following excel formulae in Cell T10:
" =If (and(or(J10="",istext(J10)),K10=""),"",Sum(K10:S10 )) "
which i would like to convert to a VBA function. The function would
then be copied down 200 rows in Column T.
Your help appreciated. Using XP with XL2003 still newbie but enjoying.
Rgds
KZ


Hi Peter
Tried the above which is a sub procedure that copies the formulae to
the range T10 to T200, what i wanted was a function so that the
formulae is not visible and therefore temperproof.
Many thks
Rgds
KZ



A UDF to perform that conditional sum in 200 cells on every re-calc will be
incredibly inefficient compared to normal worksheet formula. User will still
be able to see the formula, something like =myUDFsum(), and tamper with it
(albeit might not know how the UDF works).

If you really want to go some way at least to prevent both viewing and
tampering with the formula protect and hide formulas. Select all cells,
format, protection - uncheck 'Locked'. Now select the cells you want
protecting with hidden formulas, check both Locked and Hidden. Protect the
sheet.

Another way with VBA would be in a worksheet change event, only process
formulas that'll need updating. Advantages - all hidden from the User
without sheet protection(subject not opening the VBA project), probably
faster than a UDF. Disadvantages, lot more code to write and maintain, loss
of undo if value(s) change.

Regards,
Peter T





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default Excel formulae to VBA functions

On Apr 3, 3:16 pm, "Peter T" <peter_t@discussions wrote:
"Kieranz" wrote in message

... On Apr 3, 12:14 pm, "Peter T" <peter_t@discussions wrote:
Dim sFla As String
sFla = "=IF(AND(OR(J10="""",ISTEXT(J10)),K10=""""),"""",S UM(K10:S10))"
Range("T10:T209").Formula = sFla


Regards,
Peter T


"Kieranz" wrote in message


...





Hi all, I have the following excel formulae in Cell T10:
" =If (and(or(J10="",istext(J10)),K10=""),"",Sum(K10:S10 )) "
which i would like to convert to a VBA function. The function would
then be copied down 200 rows in Column T.
Your help appreciated. Using XP with XL2003 still newbie but enjoying.
Rgds
KZ


Hi Peter
Tried the above which is a sub procedure that copies the formulae to
the range T10 to T200, what i wanted was a function so that the
formulae is not visible and therefore temperproof.
Many thks
Rgds
KZ


A UDF to perform that conditional sum in 200 cells on every re-calc will be
incredibly inefficient compared to normal worksheet formula. User will still
be able to see the formula, something like =myUDFsum(), and tamper with it
(albeit might not know how the UDF works).

If you really want to go some way at least to prevent both viewing and
tampering with the formula protect and hide formulas. Select all cells,
format, protection - uncheck 'Locked'. Now select the cells you want
protecting with hidden formulas, check both Locked and Hidden. Protect the
sheet.

Another way with VBA would be in a worksheet change event, only process
formulas that'll need updating. Advantages - all hidden from the User
without sheet protection(subject not opening the VBA project), probably
faster than a UDF. Disadvantages, lot more code to write and maintain, loss
of undo if value(s) change.

Regards,
Peter T


Many thks to both of you, Ivan and Peter. I will try both your
suggestions.
Again thks a mill.
Rgds
KZ
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
Please suggest any formulae / functions TGV Excel Discussion (Misc queries) 2 January 20th 09 06:46 PM
Removing all formulae/functions/codes from previously saved worksh CAT Excel Discussion (Misc queries) 2 October 6th 08 12:41 PM
Two questions on worksheet protection and hiding formulae/ functions dd Excel Programming 0 January 23rd 07 04:31 PM
Nested functions in conditional formatting formulae Joseph Excel Discussion (Misc queries) 3 October 20th 05 11:52 PM
Searching TEXT in formulae, rather than results of formulae AndyE Excel Worksheet Functions 1 July 15th 05 10:57 AM


All times are GMT +1. The time now is 09:23 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"