+ Reply to Thread
Results 1 to 6 of 6

Carry Out Simple Formula on Cell Value

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-03-2012
    Location
    CDN
    MS-Off Ver
    Excel 2007
    Posts
    135

    Carry Out Simple Formula on Cell Value

    Hi All,

    I'm trying to develop some working VBA code to carry out a simple operation of a range of cells, applying the operation to the cell values within the range. I've gathered the macro from another post, and modified it, but really Im a noob and am not sure what Im doing.

    LR = Range("A" & Rows.Count).End(xlUp).Row
    With Range("F4:O" & LR)
    .Value = .Value * (1+Start!$C$15)^(F$3-Start!$C$13)
    End With
    F3 would have to move across the columns as operation proceeds. For example, all cells in F would use F3, cells in G would use G3, H would use H3, etc to column O.

    Any of you VBA guru's out there feel like making a humble noob's Friday morning????

    Peace

  2. #2
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Carry Out Simple Formula on Cell Value

    Can you post a sample file? I can't visualize it.

  3. #3
    Forum Contributor
    Join Date
    10-03-2012
    Location
    CDN
    MS-Off Ver
    Excel 2007
    Posts
    135

    Re: Carry Out Simple Formula on Cell Value

    Hi!

    Attached.

    I'm trying to incorporate inflation into the values pulled into the summary tab macro. Inflation being =(1+Inflation Rate)^(Column year - current year)
    Attached Files Attached Files

  4. #4
    Forum Contributor
    Join Date
    10-03-2012
    Location
    CDN
    MS-Off Ver
    Excel 2007
    Posts
    135

    Re: Carry Out Simple Formula on Cell Value

    Ok, so I have drawn up the following:

    Sub Inflation()
    Dim c As Range, LR As Long
    
    LR = Range("A" & Rows.Count).End(xlUp).Row
    
    For Each c In Worksheets("BUILDING SUMMARY").Range("F4:O" & LR).Cells
    c.Value = c.Value * (1 + Worksheets("Start").Cell("$C$15")) ^ ("F$3" - Worksheets("Start").Cell("$C$17"))
    Next
    End Sub
    But I get errors, can anyone help me out?
    Last edited by Jrub; 10-19-2012 at 01:51 PM.

  5. #5
    Forum Contributor
    Join Date
    10-03-2012
    Location
    CDN
    MS-Off Ver
    Excel 2007
    Posts
    135

    Re: Carry Out Simple Formula on Cell Value

    Can anyone point out what I'm doing wrong?

    With Range("F4:O" & LR)
        .Value = .Value * (1 + Worksheets("Start").Cell("$C$15")) ^ ("F$3" - Worksheets("Start").Cell("$C$17"))
    End With

  6. #6
    Forum Expert
    Join Date
    12-15-2009
    Location
    Chicago, IL
    MS-Off Ver
    Microsoft Office 365
    Posts
    3,177

    Re: Carry Out Simple Formula on Cell Value

    Do you have a sample file that illustrate the issue? The file has too much information and I am at work, so probably don't have the time to trying to figure out why the error occurs. Just an FYI.

+ 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