+ Reply to Thread
Results 1 to 6 of 6

Beats me!

  1. #1
    Joe
    Guest

    Beats me!

    Hi,

    I know this is simple, but this is going nowhere. Please help!!!

    I have a worksheet "FLS Results". All I want to do is to make the
    entire row (starting from row 2) bold if the entry in Column A is "With
    PM". (This entry comes through a list via Data validation). Following
    is the sub I wrote for it - when I run it, it gives me an error
    message, saying "Application defined or object defined error" Can
    someone tell me what's wrong with the sub?

    Sub trackres()

    Dim c As Range
    Dim i, traccode As Variant

    i = 2

    Set c = Sheets("FLS Results").Cells(2, "E")

    Do While Not IsEmpty(c)
    traccode = Sheets("FLS Results").Range(i, "A").Value
    If traccode = "With PM" Then
    Sheets("FLS Results").Range(Cells(i, "B"), Cells(i,
    "L")).Font.Bold = True
    End If
    Set c = c.Offset(1, 0)
    i = i + 1
    Loop

    End Sub

    Thanks in advance,

    Joe.


  2. #2
    Steve
    Guest

    Re: Beats me!

    Try this, it asumes that the cells without "With PM" are non blank
    and that FLS Results is the current sheet

    Sub BoldRows()
    Dim x As Integer
    Range("A2").Select

    Do Until IsEmpty(ActiveCell)
    If ActiveCell = "With PM" Then ActiveCell.EntireRow.Font.Bold = True
    ActiveCell.Offset(1).Select
    Loop

    End Sub


    "Joe" <[email protected]> wrote in message
    news:[email protected]...
    > Hi,
    >
    > I know this is simple, but this is going nowhere. Please help!!!
    >
    > I have a worksheet "FLS Results". All I want to do is to make the
    > entire row (starting from row 2) bold if the entry in Column A is "With
    > PM". (This entry comes through a list via Data validation). Following
    > is the sub I wrote for it - when I run it, it gives me an error
    > message, saying "Application defined or object defined error" Can
    > someone tell me what's wrong with the sub?
    >
    > Sub trackres()
    >
    > Dim c As Range
    > Dim i, traccode As Variant
    >
    > i = 2
    >
    > Set c = Sheets("FLS Results").Cells(2, "E")
    >
    > Do While Not IsEmpty(c)
    > traccode = Sheets("FLS Results").Range(i, "A").Value
    > If traccode = "With PM" Then
    > Sheets("FLS Results").Range(Cells(i, "B"), Cells(i,
    > "L")).Font.Bold = True
    > End If
    > Set c = c.Offset(1, 0)
    > i = i + 1
    > Loop
    >
    > End Sub
    >
    > Thanks in advance,
    >
    > Joe.
    >




  3. #3
    Joe
    Guest

    Re: Beats me!

    Thanks, Steve. But any idea why my logic & Syntax didnt work? (I mean,
    it is kinda straightforward, aint it?)

    Also, I cant assume Col A to be nonempty - the only tracking column
    here would be Col E.

    Any suggestions?

    Thanks,

    Joe.


  4. #4
    Jim Cone
    Guest

    Re: Beats me!

    Joe,
    Try changing...
    Sheets("FLS Results").Range(Cells(i, "B"), Cells(i,"L")).Font.Bold = True
    To
    With Sheets("FLS Results")
    .Range(.Cells(i, "B"), .Cells(i,"L")).Font.Bold = True
    End With

    Note the dots in front of Cells.

    Jim Cone
    San Francisco, USA
    http://www.realezsites.com/bus/primitivesoftware


    "Joe" <[email protected]> wrote in message
    Hi,
    I know this is simple, but this is going nowhere. Please help!!!
    I have a worksheet "FLS Results". All I want to do is to make the
    entire row (starting from row 2) bold if the entry in Column A is "With
    PM". (This entry comes through a list via Data validation). Following
    is the sub I wrote for it - when I run it, it gives me an error
    message, saying "Application defined or object defined error" Can
    someone tell me what's wrong with the sub?

    Sub trackres()
    Dim c As Range
    Dim i, traccode As Variant
    i = 2
    Set c = Sheets("FLS Results").Cells(2, "E")

    Do While Not IsEmpty(c)
    traccode = Sheets("FLS Results").Range(i, "A").Value
    If traccode = "With PM" Then
    Sheets("FLS Results").Range(Cells(i, "B"), Cells(i,
    "L")).Font.Bold = True
    End If
    Set c = c.Offset(1, 0)
    i = i + 1
    Loop
    End Sub
    Thanks in advance,
    Joe.

  5. #5
    Forum Contributor
    Join Date
    01-10-2006
    Location
    Ahmedabad, India
    MS-Off Ver
    Office 2000
    Posts
    346
    Perhaps a small syntax error. your line
    traccode = Sheets("FLS Results").Range(i, "A").Value

    could be

    traccode = Sheets("FLS Results").Cells(i, "A").Value

    A V Veerkar

  6. #6
    Joe
    Guest

    Re: Beats me!

    Thanks a lot, guys. All your inputs were useful in one way or the
    other. 'Appreciate it.

    Joe.


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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