Results 1 to 8 of 8

Help regrading if condition in vba for range selection

Threaded View

  1. #1
    Registered User
    Join Date
    09-03-2022
    Location
    INDIA,Imphal
    MS-Off Ver
    2019
    Posts
    9

    Post Help regrading if condition in vba for range selection

    My problem is this. The Below code works however.
    Private Sub Worksheet_Calculate()
    
    If Range("K3").Value = "TRIG" Then
    Range("K3").Value = "TRIGGERED"
    End If
    If Range("O3").Value = "TODAY" Then
    Range("O3").Value = Range("$F$1").Value
    End If
    If Range("P3").Value = "TODAY" Then
    Range("P3").Value = Range("$F$1").Value
    Range("T3").Value = Range("S3").Value
    End If
    
    If Range("K4").Value = "TRIG" Then
    Range("K4").Value = "TRIGGERED"
    End If
    If Range("O4").Value = "TODAY" Then
    Range("O4").Value = Range("$F$1").Value
    End If
    If Range("P4").Value = "TODAY" Then
    Range("P4").Value = Range("$F$1").Value
    Range("T4").Value = Range("S4").Value
    End If
    
    If Range("K5").Value = "TRIG" Then
    Range("K5").Value = "TRIGGERED"
    End If
    If Range("O5").Value = "TODAY" Then
    Range("O5").Value = Range("$F$1").Value
    End If
    If Range("P5").Value = "TODAY" Then
    Range("P5").Value = Range("$F$1").Value
    Range("T5").Value = Range("S5").Value
    End If
    
    End Sub
    what i am trying to do is apply it the the entire table like below

    Private Sub Worksheet_Calculate()
    
    If Range("K3:K"& Cells(Rows.Count, "C").End(xlUp).Row).Value = "TRIG" Then
    Range("K3:K"& Cells(Rows.Count, "C").End(xlUp).Row)).Value = "TRIGGERED"
    End If
    If Range("O3:O"& Cells(Rows.Count, "C").End(xlUp).Row).Value = "TODAY" Then
    Range("O3:O"& Cells(Rows.Count, "C").End(xlUp).Row).Value = Range("$F$1").Value
    End I
    If Range("P3:P"& Cells(Rows.Count, "C").End(xlUp).Row).Value = "TODAY" Then
    Range("P3:P"& Cells(Rows.Count, "C").End(xlUp).Row).Value = Range("$F$1").Value
    Range("T3:T"& Cells(Rows.Count, "C").End(xlUp).Row).Value = Range("S3:S"& Cells(Rows.Count, "C").End(xlUp).Row).Value
    End If
    
    End Sub
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #2 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer

    how do i implement it

    attach file sosauto.xlsm
    Last edited by 6StringJazzer; 09-03-2022 at 12:20 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 08-20-2021, 05:52 PM
  2. [SOLVED] Random selection according to a customized condition
    By meetgilbert in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-13-2020, 08:06 AM
  3. If condition for multi selection
    By alaboudy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-27-2017, 06:54 AM
  4. [SOLVED] Range(Selection, Selection.End(xlDown)).Select goes to 65536 instead of last filled row
    By looney in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-12-2013, 10:51 AM
  5. Replies: 2
    Last Post: 04-20-2012, 12:23 PM
  6. How to Query with Date Selection Condition
    By antoni in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-26-2011, 05:22 AM
  7. Dynamic row selection based on condition
    By Hornet222 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-03-2011, 04:25 PM

Tags for this Thread

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