Results 1 to 3 of 3

Thread: [RESOLVED]repeat forumla

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    20

    [RESOLVED]repeat forumla

    hi all
    if i need use the same formula for the same country how do i make it so that i do not copy and paste it again.like country "fra" and "aus" uses the same formula,how am i able to reduce the coding by not copying and paste the formula cause i having some country using the same forumla.

    VB Code:
    1. If c = "fra" Then
    2.     Select Case Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    3.     Case 20 To 35
    4.         c.Offset(0, 4) = 20# * Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    5.     Case 36 To 45
    6.         c.Offset(0, 4) = 20# * Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    7.     Case Is > 100000
    8.         c.Offset(0, 4) = 5.5 * Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    9.     Case Is > 1000
    10.         c.Offset(0, 4) = 6# * Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    11.     Case Is > 300
    12.         c.Offset(0, 4) = 8# * Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    13.     Case Is > 45
    14.         c.Offset(0, 4) = 10# * Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    15.     Case Else
    16.         c.Offset(0, 4) = 100#
    17.     End Select
    18. End If
    VB Code:
    1. If c = "aus" Then
    2.     Select Case Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    3.     Case 20 To 35
    4.         c.Offset(0, 4) = 20# * Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    5.     Case 36 To 45
    6.         c.Offset(0, 4) = 20# * Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    7.     Case Is > 100000
    8.         c.Offset(0, 4) = 5.5 * Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    9.     Case Is > 1000
    10.         c.Offset(0, 4) = 6# * Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    11.     Case Is > 300
    12.         c.Offset(0, 4) = 8# * Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    13.     Case Is > 45
    14.         c.Offset(0, 4) = 10# * Application.Max(c.Offset(0, 1), c.Offset(0, 2))
    15.     Case Else
    16.         c.Offset(0, 4) = 100#
    17.     End Select
    18. End If
    Attached Files Attached Files
    Last edited by surface; Aug 1st, 2005 at 10:58 AM.

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: repeat forumla

    Code:
    if c="aus" or c="fra" Then
    '---- your code here
    end if
    Only if they are the same and will stay the same.

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2005
    Posts
    20

    Re: repeat forumla

    ok thx for the help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width