Results 1 to 4 of 4

Help with writing a simple range programme in VBA

Threaded View

jembop Help with writing a simple... 02-06-2014, 05:47 AM
millz Re: VBA help please - i'm a... 02-06-2014, 05:51 AM
Fotis1991 Re: VBA help please - i'm a... 02-06-2014, 05:51 AM
millz Re: Help with writing a... 02-06-2014, 06:15 AM
  1. #1
    Registered User
    Join Date
    02-06-2014
    Location
    Guildford
    MS-Off Ver
    Excel 2010
    Posts
    5

    Question Help with writing a simple range programme in VBA

    Hi all

    I'm trying to teach myself VBA and am trying to build a really simple programme which looks at a range of text data from cell A1 to cell E10, and if the text says 'fraud' then the cell will be highlighted a certain colour.
    The code I have written is a mash up from various sources on the internet and I have no idea whether it's suitable or not. I keep getting the error "End if without Block If" which I understand to mean my 'If' instruction is not correct.

    Here is my code, could someone please advise me?

    
    Sub Test()
    '
    ' Test Macro
    '
    Dim Rownumber As Integer
    Dim rng As Range, cell As Range
    Set rng = Range("A1:E10")
    
    For Each cell In rng
    
    If cell.Value = "Fraud" Then cell.Interior.ColorIndex = 60
    End If
    End Sub
    Last edited by jembop; 02-06-2014 at 05:55 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Hello from a beginner
    By bstinson in forum Hello..Introduce yourself
    Replies: 5
    Last Post: 08-11-2013, 09:57 PM
  2. Beginner!
    By coffeemints in forum Hello..Introduce yourself
    Replies: 1
    Last Post: 02-28-2013, 07:22 PM
  3. Beginner in VBA
    By neeraj_joshi48 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-01-2012, 06:58 AM
  4. VBA Beginner
    By tt388 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-07-2007, 09:17 AM
  5. Beginner's help
    By jello in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-08-2005, 12:06 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