+ Reply to Thread
Results 1 to 2 of 2

highlights cell based on text -- error -13

Hybrid View

karurkumar highlights cell based on text... 07-03-2017, 07:01 AM
Sintek Re: highlights cell based on... 07-03-2017, 08:05 AM
  1. #1
    Registered User
    Join Date
    06-17-2017
    Location
    tamilnadu
    MS-Off Ver
    2013
    Posts
    9

    highlights cell based on text -- error -13

    Hai in the below code error -13 type missmatch coming in kumarL

    what i did wrong ??
    Sub kumarK()
    IRow = Workbooks("01A  data 1 MT --1.xlsm").Sheets("DATAIND1").Range("k" & Rows.Count).End(xlUp).Row
    Set MR = Workbooks("01A  data 1 MT --1.xlsm").Sheets("DATAIND1").Range("k2:k" & IRow)
    For Each cell In MR
    If cell.Value = "BUY" Then cell.Interior.ColorIndex = 10
    If cell.Value = "SELL" Then cell.Interior.ColorIndex = 3
    Next
    
    End Sub
    
    
    Sub kumarL()
    IRow = Workbooks("01A  data 1 MT --1.xlsm").Sheets("DATAIND1").Range("L" & Rows.Count).End(xlUp).Row
    Set MR = Workbooks("01A  data 1 MT --1.xlsm").Sheets("DATAIND1").Range("L2:L" & IRow)
    For Each cell In MR
    If cell.Value = "BULLISH trend" Then cell.Interior.ColorIndex = 10
    If cell.Value = "DOWN trend" Then cell.Interior.ColorIndex = 3
    Next
    
    End Sub

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,957

    Re: highlights cell based on text -- error -13

    Try this and see if it errors....
    Option Explicit
    
    Sub kumarL()
    Dim MR As Range, cell As Range
    Set MR = Sheets("DATAIND1").Range("L2", Range("L" & Rows.Count).End(xlUp))
    For Each cell In MR
        If cell = "BULLISH trend" Then cell.Interior.ColorIndex = 10
        If cell = "DOWN trend" Then cell.Interior.ColorIndex = 3
    Next cell
    End Sub
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

+ 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. [SOLVED] Code Check Please, Highlights based of values
    By Fawkes_ in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-08-2017, 05:16 PM
  2. Copy text based on highlights
    By lparri in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-21-2016, 08:05 PM
  3. [SOLVED] Yellow highlights text summary
    By makinmomb in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-22-2015, 02:32 AM
  4. Debug Error Expected Array: Highlights my UBound statement
    By CRIMEDOG in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-07-2015, 05:05 AM
  5. putting an if condition based on text in a cell - runtime error 13: type mismatch
    By rbs123 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-29-2013, 04:02 AM
  6. Highlights several cell based on single cell value (on the same raw) , vba
    By dainova in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-27-2013, 04:30 PM
  7. Highlights Numbers (which are in text)
    By moody in forum Excel General
    Replies: 3
    Last Post: 02-20-2012, 06:40 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