Results 1 to 3 of 3

fill empty with two condition

Threaded View

  1. #1
    Forum Contributor
    Join Date
    02-14-2010
    Location
    oman
    MS-Off Ver
    Excel 2003
    Posts
    384

    Post fill empty with two condition

    Sub Package()
     
    Dim CalculatedValue
    Range("L2").Select
    Do
        If ActiveCell.Value = "" Then
            CalculatedValue = Application.WorksheetFunction.RoundUp(ActiveCell.Offset(0, -1).Value / 1.5, 0) * 1.5
          Select Case CalculatedValue
          Case 61.5, 63: ActiveCell.Value = 64.5
                Case 31.5, 33: ActiveCell.Value = 34.5
                Case Else: ActiveCell.Value = CalculatedValue
                End Select
            End If
            ActiveCell.Offset(1, 0).Select
        Loop Until IsEmpty(ActiveCell.Offset(0, -2))
    End Sub
    dear friends above macro work fine for me.i need to add two conditions to that macro.it's like this.
    01.if Column "G" value " TP " & Column "H" value " 150D " then above 1.5 should change to 0.9
    CalculatedValue = Application.WorksheetFunction.RoundUp(ActiveCell.Offset(0, -1).Value / .9, 0) * .9
    02.if Column "G" value " PP " & Column "H" value " 16/2 " then above 1.5 should change to 1
    CalculatedValue = Application.WorksheetFunction.RoundUp(ActiveCell.Offset(0, -1).Value / 1, 0) * 1
    Column "G' & column "H" values other than above then 1.5 is correct.
    CalculatedValue = Application.WorksheetFunction.RoundUp(ActiveCell.Offset(0, -1).Value / 1.5, 0) * 1.5
    pls anybody can help me to do that......
    Last edited by johncena; 02-22-2010 at 04:28 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1