+ Reply to Thread
Results 1 to 3 of 3

Variable as result of Divide (Sum) Function

  1. #1
    David
    Guest

    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 ***(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!

  2. #2
    Tom Ogilvy
    Guest

    Re: 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" <David@discussions.microsoft.com> wrote in message
    news:979CCED2-A902-475F-BCC4-FB82CB026199@microsoft.com...
    >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 ***(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!




  3. #3
    David
    Guest

    Re: 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" <David@discussions.microsoft.com> wrote in message
    > news:979CCED2-A902-475F-BCC4-FB82CB026199@microsoft.com...
    > >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 ***(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!

    >
    >
    >


+ Reply to Thread

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