Results 1 to 3 of 3

Thread: [RESOLVED]repeat forumla

Threaded View

  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.

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