ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Variable as result of Divide (Sum) Function (https://www.excelbanter.com/excel-programming/368752-variable-result-divide-sum-function.html)

David

Variable as result of Divide (Sum) Function
 
I have a macro that takes values from spreadsheets sent to our office and
posts the values to a consolidated spreadsheet.
I need a value that is the result of a sum function (would look like this if
in a cell cum(c106/c92). I have to perform the function and then assign it to
a variable named iValueCMGM. The value of this variable is then pasted into
the consolidated workbook.
I tried this but it didn't work:
iValueCMGM = .Range("C106" / "C92")

Can anyone help?
Thanks!

Tom Ogilvy

Variable as result of Divide (Sum) Function
 
dim iValueCMGM as Double

With worksheets("Sheet1")
if isnumeric(.Range("C106").Value) and _
isnumeric(.Range("C92").Value) then
if Range("C92").Value < 0 then
iValueCMGM = .Range("C106").Value / .Range("C92").Value
end if
end if
End With

--
Regards,
Tom Ogilvy


"David" wrote in message
...
I have a macro that takes values from spreadsheets sent to our office and
posts the values to a consolidated spreadsheet.
I need a value that is the result of a sum function (would look like this
if
in a cell cum(c106/c92). I have to perform the function and then assign it
to
a variable named iValueCMGM. The value of this variable is then pasted
into
the consolidated workbook.
I tried this but it didn't work:
iValueCMGM = .Range("C106" / "C92")

Can anyone help?
Thanks!




David

Variable as result of Divide (Sum) Function
 
Thank you oh mighty one!!

"Tom Ogilvy" wrote:

dim iValueCMGM as Double

With worksheets("Sheet1")
if isnumeric(.Range("C106").Value) and _
isnumeric(.Range("C92").Value) then
if Range("C92").Value < 0 then
iValueCMGM = .Range("C106").Value / .Range("C92").Value
end if
end if
End With

--
Regards,
Tom Ogilvy


"David" wrote in message
...
I have a macro that takes values from spreadsheets sent to our office and
posts the values to a consolidated spreadsheet.
I need a value that is the result of a sum function (would look like this
if
in a cell cum(c106/c92). I have to perform the function and then assign it
to
a variable named iValueCMGM. The value of this variable is then pasted
into
the consolidated workbook.
I tried this but it didn't work:
iValueCMGM = .Range("C106" / "C92")

Can anyone help?
Thanks!






All times are GMT +1. The time now is 12:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com