Results 1 to 4 of 4

[SOLVED] FormulaR1C1 in Case statement?

Threaded View

  1. #1
    Forum Contributor
    Join Date
    10-27-2005
    Posts
    177

    [SOLVED] FormulaR1C1 in Case statement?

    Hello everyone

    I have the following code:

        Dim i As Long
        For i = 2 To Range("A" & Rows.Count).End(3).Row
            Select Case True
            
                Case Cells(i, "A") Like "John"
                    Cells(i, "C") = "=$Q$1"
           
            End Select
        
        Next i
    This assigns a static formula (=$Q$1) to each cell in column C (starting in C2) if the cell in column A has "John".

    However, say I want instead for the formula to pick up a value in column B. So C2 would have the formula =B2*$Q$1 , C3 would be =B3*$Q$1, C4 would be =B4*$Q$1 , and so on , is there a way to modify the code to do this?

    Any help would be much appreciated!
    Last edited by uberathlete; 06-17-2016 at 03:05 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] i have an if then statement that works, how to make it work as a with or case statement
    By dmcgov in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 06-03-2016, 03:34 PM
  2. [SOLVED] Using IF Statement With .FormulaR1C1
    By Gard5096 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2013, 04:50 PM
  3. Replies: 5
    Last Post: 07-19-2012, 02:53 AM
  4. A better Case (was "Create Loop with Case statement")
    By Rick_Stanich in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-16-2009, 12:55 PM
  5. [SOLVED] Utilize a Select Case Statement in Target Intersect Statement
    By max57 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-29-2009, 08:55 PM
  6. Switch(case) statement(enhanced if statement)
    By zapopaul in forum Excel General
    Replies: 6
    Last Post: 10-24-2008, 06:53 PM
  7. Case:If Statement
    By yogesh7980 in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 05-14-2007, 08:18 AM

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