Results 1 to 8 of 8

Modifying vba code .Formula to cell range

Threaded View

  1. #1
    Forum Contributor
    Join Date
    03-29-2012
    Location
    Canada
    MS-Off Ver
    2007
    Posts
    818

    Modifying vba code .Formula to cell range

    Good day,
    I am trying to modify my code to fit my need but I don't quite remember how I got there. I need to change this code to have a cell range on another sheet that I have.

    Here is the original code:

    If Not Intersect(Target, Range("B5:B30")) Is Nothing Then
        Application.EnableEvents = False
            For i = 1 To Target ' stops the code looping
                tmpArr = tmpArr & "," & i
            Next i
        With Target
        
        With .Offset(, 1).Resize(.Value)
            .NumberFormat = "000"
            .Value = Application.Transpose(Split(Mid(tmpArr, 2), ","))
            .Formula = "=A$" & .row & "&""/""&TEXT(ROW()-" & .row - 1 & ",""000""""/HS"""""")" 'this line needs changing
            .Value = .Value
        End With
            .Offset(0, -1).Copy .Offset(0, -1).Resize(.Value)
            .Offset(0, 1).Select
        End With
        Application.EnableEvents = True
    I need to change the following to instead of having /HS to have / & Sheets("Controls").Range("D3")

    I need to have this inserted and I tried different tactics but I am getting errors.

    .Formula = "=A$" & .row & "&""/""&TEXT(ROW()-" & .row - 1 & ",""000""""/HS"""""")"
    To

    .Formula = "=A$" & .row & "&""/""&TEXT(ROW()-" & .row - 1 & ",""000""""/ & Sheets("Controls").Range("D3")"""""")"
    Please help
    Last edited by Excelnoub; 03-02-2014 at 01:51 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Modifying code that locks a cell to be a password hidden in a specific cell?
    By jonvanwyk in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-20-2012, 02:38 PM
  2. Assist in modifying code to locate an exact phrase in a cell
    By Jsin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-09-2010, 02:52 PM
  3. Help modifying code to check for text in a range prior to email sheet.
    By dcgrove in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-09-2009, 06:16 PM
  4. Modifying a sumproduct formula to search for words in a cell
    By Weasel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-07-2009, 02:51 PM
  5. modifying this formula to return an empty cell
    By Outbacker in forum Excel General
    Replies: 3
    Last Post: 08-22-2006, 03:10 PM

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