Hi,
Some of my code is below. I am getting a value and storing it into a variable and then multiplying this value by a fixed percentage stored in a cell. For example, the value may be 3, the calculation goes 3 * 10% = the variable then calculates 3.3. For anything that is .5 or above I need to round up i.e. 4. For anythigng that is <.5 I need to round down i.e. 3.
I've tried the round function but it currently returns 0! All help appreciated
Application.ScreenUpdating = False
Dim nRowsChill As Double
Dim nRowsMeat As Double
Dim nRowsProduce As Double
Dim rngStoreNrs As Range
Dim cStore As Range
Dim nUpliftQty As Double
Dim nUpliftRound As Double
Dim nChillQty As Double
Dim nChillUplift As Double
Dim nMeatQty As Double
Dim nMeatUplift As Double
Dim nProduceQty As Double
Dim nProduceUplift As Double
With ActiveSheet
'If no uplift percent keyed, restore original values
If Range("ChillUplift") = 0 And Range("ProduceUplift") = 0 And Range("MeatUplift") = 0 Then
.Range("I8:I" & Range("I65536").End(xlUp).Row).Copy Destination:=Range("F8")
.Range("J8:J" & Range("J65536").End(xlUp).Row).Copy Destination:=Range("G8")
.Range("K8:K" & Range("K65536").End(xlUp).Row).Copy Destination:=Range("H8")
Application.CutCopyMode = False 'clear copy (ergo, clear clipboard)
Else
Set rngStoreNrs = Range("D8", Range("D8").End(xlDown))
'Get current uplift percentages
nRowsChill = Range("ChillUplift").Value
nRowsProduce = Range("ProduceUplift").Value
nRowsMeat = Range("MeatUplift").Value
For Each cStore In rngStoreNrs
nChillQty = cStore.Offset(0, 5).Value 'original chill qty
nUpliftQty = nChillQty + (nChillQty * nRowsChill) ' apply uplift calcuation
MsgBox nUpliftQty
nUpliftQty = Application.Round(nUpliftQty, 1)
MsgBox nUpliftQty
Some of my code is below. I am getting a value and storing it into a variable and then multiplying this value by a fixed percentage stored in a cell. For example, the value may be 3, the calculation goes 3 * 10% = the variable then calculates 3.3. For anything that is .5 or above I need to round up i.e. 4. For anythigng that is <.5 I need to round down i.e. 3.
I've tried the round function but it currently returns 0! All help appreciated
Application.ScreenUpdating = False
Dim nRowsChill As Double
Dim nRowsMeat As Double
Dim nRowsProduce As Double
Dim rngStoreNrs As Range
Dim cStore As Range
Dim nUpliftQty As Double
Dim nUpliftRound As Double
Dim nChillQty As Double
Dim nChillUplift As Double
Dim nMeatQty As Double
Dim nMeatUplift As Double
Dim nProduceQty As Double
Dim nProduceUplift As Double
With ActiveSheet
'If no uplift percent keyed, restore original values
If Range("ChillUplift") = 0 And Range("ProduceUplift") = 0 And Range("MeatUplift") = 0 Then
.Range("I8:I" & Range("I65536").End(xlUp).Row).Copy Destination:=Range("F8")
.Range("J8:J" & Range("J65536").End(xlUp).Row).Copy Destination:=Range("G8")
.Range("K8:K" & Range("K65536").End(xlUp).Row).Copy Destination:=Range("H8")
Application.CutCopyMode = False 'clear copy (ergo, clear clipboard)
Else
Set rngStoreNrs = Range("D8", Range("D8").End(xlDown))
'Get current uplift percentages
nRowsChill = Range("ChillUplift").Value
nRowsProduce = Range("ProduceUplift").Value
nRowsMeat = Range("MeatUplift").Value
For Each cStore In rngStoreNrs
nChillQty = cStore.Offset(0, 5).Value 'original chill qty
nUpliftQty = nChillQty + (nChillQty * nRowsChill) ' apply uplift calcuation
MsgBox nUpliftQty
nUpliftQty = Application.Round(nUpliftQty, 1)
MsgBox nUpliftQty