Results 1 to 2 of 2

Using variables in formulas/ranges

Threaded View

  1. #1
    Registered User
    Join Date
    04-26-2013
    Location
    SLC
    MS-Off Ver
    Excel 2010
    Posts
    2

    Using variables in formulas/ranges

    Note: I am pretty new to this, so forgive my mistakes.

    I have a worksheet that changes every month. New rows are added or subtracted, so I need to use variables to select ranges.

    I have been trying to use variables to select a certain range in another worksheet so I can use it in another worksheet. The code is below. I am getting errors at these two spots:

    Let netincome = jan & inloss & ":" & jan & inloss
    
     ActiveCell.Formula = "=sum('Local Results-F'!" & netincomerange & ")"
    Any help is appreciated.

    Dim jan As String
            
            With Cells.Find(What:="January", After:=ActiveCell, LookIn:= _
            xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
            xlNext, MatchCase:=False, SearchFormat:=False).Activate
            End With
            
            jan = ActiveCell.Column
        
            Application.Workbooks("88888.xlsx").Close False
            
         ''NET INCOME
    
        Sheets("Consolidated-F").Activate
        
        With Cells.Find(What:="Net Income (Loss)", After:=ActiveCell, LookIn:= _
        xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:= _
        xlNext, MatchCase:=False, SearchFormat:=False).Activate
        End With
    
        netinloss = ActiveCell.Row
        
        Dim netincomerange As Range
        
        Let netincome = jan & inloss & ":" & jan & inloss
    
       Set netincomerange = Range(netincome)
        
        Range("C" & netinloss).Activate
        ActiveCell.Formula = "=sum('Local Results-F'!" & netincomerange & ")"
        
            End Sub
    Last edited by lfmaykot; 05-21-2013 at 02:47 PM.

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