+ Reply to Thread
Results 1 to 1 of 1

Dynamic formula using >=<

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-06-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    181

    Dynamic formula using >=<

    Hi all,

    I am trying to make a dynamic formula by using the >=< signs and referencing them from the spreadsheet i.e. I do not want to use them directly in the VBA code. I started writing this (code below just to show my attempt) but then I realised I did not know how to set up the forumla by referencing the >=< signs and the numbers in the spreadsheet (Spreadsheet attached).

    Option Explicit
    Sub RuleTesting()
    
    Dim QRule As String
    Dim RTRule As String
    Dim CurrentResult As Integer
    Dim Red As String
    Dim Amber As String
    Dim Green As String
    
    
    
    ' Variables
    QRule = Sheets("Results_Q").Range("E2").Value
    RTRule = Sheets("RuleTable_RT").Range("A2").Value
    Red = Sheets("RuleTable_RT").Range("B2").Value & Sheets("RuleTable_RT").Range("C2").Value
    Green = Sheets("RuleTable_RT").Range("F2").Value & Sheets("RuleTable_RT").Range("G2").Value
    If QRule = RTRule Then
    CurrentResult = Sheets("Results_Q").Range("D2")
    Else
    End If
    
    
    If CurrentResult = Red Then
    Sheets("Results_Q").Range("F2").Value = Red
    ElseIf CurrentResult = Green Then
    Sheets("Results_Q").Range("F2").Value = Green
    Else
    Sheets("Results_Q").Range("F2").Value = Amber
    End If
    
    End Sub
    P.s. I have recently attended introduction and intermediate courses so I am relatively new to VBA. Any help would be much appreciated.

    Regards,

    Forrestgump
    Attached Files Attached Files
    Last edited by forrestgump1980; 12-16-2014 at 08:53 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA - Updating Dynamic Line Chart & Inserting Dynamic Formula
    By bruno08102013 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-09-2014, 10:10 AM
  2. Replies: 0
    Last Post: 02-28-2006, 09:10 PM
  3. Replies: 0
    Last Post: 02-28-2006, 09:10 PM
  4. Replies: 0
    Last Post: 02-28-2006, 09:10 PM
  5. Dynamic Range with unused formula messing up x axis on dynamic graph
    By cabybake@yahoo.com in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 02-02-2006, 04: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